944,152 Members | Top Members by Rank

Ad:
You are currently viewing page 1 of this multi-page discussion thread
Jun 11th, 2007
0

loadin a form

Expand Post »
hi....actually wen i am loading a form from the module.....its loaded but its not holding on to the screen and it is performing the actions listed in the form load procedure......can anyone tell me what should i do to make the form hold on to the screen....it would be of great help....thanx...
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
anud18 is offline Offline
52 posts
since Jun 2007
Jun 11th, 2007
0

Re: loadin a form

Hi,

Are u sure Form's Visible = True...?
Instead of calling a Form In Module, Do it the other way-round.
Change the Start-Up Form To the First Form,
and in that Form-Load, Call the Module Procedure.

Regards
Veena
Reputation Points: 84
Solved Threads: 140
Posting Shark
QVeen72 is offline Offline
923 posts
since Nov 2006
Jun 11th, 2007
0

Re: loadin a form

First try to understand why a form is loaded (made visible). It is either to attract the user with some message or for some input/selection. You are not supposed to write any code other than that in the form load event. Only a control in the form if activated by the user or if it elapse in time in its visibility, then only other procedures should start.
In assence a form actually is a tool to invite the participation of the user for a specific action/s he or she wants to do. Keep that in mind while writing the code inside the form_load. Check up the code inside the form_load(). You will find the actual bug.
Reputation Points: 10
Solved Threads: 9
Junior Poster
AV Manoharan is offline Offline
166 posts
since Jun 2007
Jun 11th, 2007
0

Re: loadin a form

And also you should SetFocus to some of the controls in the so called form_load.
Reputation Points: 10
Solved Threads: 9
Junior Poster
AV Manoharan is offline Offline
166 posts
since Jun 2007
Jun 11th, 2007
0

Re: loadin a form

Take out the codes for db connection and recordset from the called form_load and paste it in the module before the form_load line. When the form_load is invoked from that module control is passed to that form_load(). The recordset is still avilable to you in the just loaded form. open it. Read the required data from the database. Fill the data on the different contols in the form and set focus to any control in the form. There you are.
Reputation Points: 10
Solved Threads: 9
Junior Poster
AV Manoharan is offline Offline
166 posts
since Jun 2007
Jun 11th, 2007
0

Re: loadin a form

thank you so much sir.....it almost worked out...but it is showing an error "object required " alongside when the form is opened.....when i try to debug it...it takes the control in the form where i am accessing the record set....
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
anud18 is offline Offline
52 posts
since Jun 2007
Jun 11th, 2007
0

Re: loadin a form

Natuarally I thought it will happen. First try to declare the variable cnn and recordset as a global varaible so that from any sub you can access them.
Otherwise. you can do one thing. In the module where you invoked the form_load() just pass the recordset to the form_load.
Example
formx_load myRecordeSet

and in the form_load module

Private Sub Formx_Load(myRecordSet)

if both variable are same it is OK

Now I will tell you one simple debugging technique.

Put as many MsgBox in the program where you find you are struck up.
for example in you module where you are trying to accee the form_load
place this line.

MsgBox "I have set up the connection and passed the recordset to the formload "
then place the code

formx_load myRecordSet

Then in the
Private Sub Formx_load(myRecordSet)

MsgBox "I am inside the formx_load and I got the recordset and now I am going to open it"

then Open the record set and select the fields from the Database.
again give

MsgBox "Now I have read the data"

Likewise you can debug beautifully
Reputation Points: 10
Solved Threads: 9
Junior Poster
AV Manoharan is offline Offline
166 posts
since Jun 2007
Jun 11th, 2007
0

Re: loadin a form

i have tried the above given procedure also....but the problem still remains the same ...that is the form which i am calling from the module isnt holding on the screen......the control immediately passes on to the next step in the module....
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
anud18 is offline Offline
52 posts
since Jun 2007
Jun 11th, 2007
0

Re: loadin a form

I am very sorry to keep you so long. I have been out.
The only alternative thing can be some thing wrong with your
formx.show
To get hold of the consecutive forms you had to mention with the sow the model

Formx.Show vbModel

Revert the code to the earlier state and change the show in this way.
I think it has to work.
Get back to me immediately if it works or tomorrow I will try to help you.
Reputation Points: 10
Solved Threads: 9
Junior Poster
AV Manoharan is offline Offline
166 posts
since Jun 2007
Jun 12th, 2007
0

Re: loadin a form

i am thankful to you sir for taking such interest.....i have tried
Formx.Show vbModel also but its not working out
Reputation Points: 10
Solved Threads: 0
Junior Poster in Training
anud18 is offline Offline
52 posts
since Jun 2007

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Visual Basic 4 / 5 / 6 Forum Timeline: Passing formname as variable
Next Thread in Visual Basic 4 / 5 / 6 Forum Timeline: deleting record from db using tableadapter





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC