Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Ok Form Load over Button Press

Status
Not open for further replies.

Zeroanarchy

Technical User
Jun 11, 2001
630
AU
Hi All,

Wondering if someone might be able to explain the following problem, I have created a piece of loop code that on button press works fantastic. When I add the same

code:
do
loop procedure
docmd Close
docmd open form such and such

it does nothing. Is this because the form details have not had time to display on the form??

eg:

Open -> Load -> Resize -> Activate -> Current


At what stage in the above are the fields on the screen populated? and what is the quickest way to run a piece of code similar to mine and then exit the form

Unload -> Deactivate -> Close



cheers [afro]ZeroAnarchy
Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.

 
have you put in a breakpoint and stepped through the code? Or doesn't it run at all? On what event did you put the code?
 
I have code that both updates properties of controls and performs other functions which works on the OnCurrent event. This is appropriate if you need to modify the form for special conditions based on data in the current record.
The code will run everytime you switch to a new record.

If you just need to modify properties of the form in general, like change the title to reflect the current user's name, Activate is better. The code will run only once per activation of the form.
 
I have the same trouble. I have used the Timer event to cause a short delay between the load event and the procedure call. (Timer Interval can be short - like 100ms)

Private Sub Form_Timer()
Dim iVar As Integer
For iVar = 0 To 1
iVar = iVar + 1
Next
'ProcCall
Exit Sub
End Sub
 
Hi grnzbra,
The code was placed in a button before it was transferred across to On_Open / On_Load and it worked fine. Its only when it is placed in the On_Open / On_Load that it does not work. My belief is, is it is trying to work but it is firing off before the fields in the form have any data in them.

Hey JoyInOK,
No information on the form is needed to be changed manually this is a totally Automatic procedure. The form is also continuous.

I just need to know at what stage does the data fill the fields?

Open -> Load -> Resize -> Activate -> Current

Is it between Open and Load or after Load?

Cheers
[afro]ZeroAnarchy
Experience is a wonderful thing. It enables you to recognize a mistake
when you make it again.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top