Current form takes too long to close

R

Ricoy-Chicago

I have a form [Welcome] where a user types the [Last Name], [First Name]
criteria (in textboxes), and he/she clicks on a command button to display the
records matching the criteria in the [Edit RecordMainForm] form. The Edit
form contains two subforms. The [Welcome] form does not close because of the
criteria needed.

Everything works fine but... the [EditRecordMainForm] form has a command
button to close it. When the user clicks on the command button, the
[EditRecord...] and [Welcome] forms are BOTH displayed for about 2-3 seconds,
then the [Welcome] form is maximized. This is the coding for the command
button on the [Edit...] form:

DoCmd.Close acForm, "EditRecordsMainForm", acSaveNo
stDocName = "Welcome"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize

The [Welcome] form has an coding associated with the [On Activate] event.
The coding just clears the text boxes and setfocus.

Any help will be greatly appreciated.
 
D

Douglas J. Steele

See whether it makes a difference putting

DoEvents

after the DoCmd.Close statement.
 
R

Ricoy-Chicago

Yes! it works... thanks

Douglas J. Steele said:
See whether it makes a difference putting

DoEvents

after the DoCmd.Close statement.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Ricoy-Chicago said:
I have a form [Welcome] where a user types the [Last Name], [First Name]
criteria (in textboxes), and he/she clicks on a command button to display
the
records matching the criteria in the [Edit RecordMainForm] form. The Edit
form contains two subforms. The [Welcome] form does not close because of
the
criteria needed.

Everything works fine but... the [EditRecordMainForm] form has a command
button to close it. When the user clicks on the command button, the
[EditRecord...] and [Welcome] forms are BOTH displayed for about 2-3
seconds,
then the [Welcome] form is maximized. This is the coding for the command
button on the [Edit...] form:

DoCmd.Close acForm, "EditRecordsMainForm", acSaveNo
stDocName = "Welcome"
DoCmd.OpenForm stDocName, , , stLinkCriteria
DoCmd.Maximize

The [Welcome] form has an coding associated with the [On Activate] event.
The coding just clears the text boxes and setfocus.

Any help will be greatly appreciated.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top