Different results with opening form with docmd.

C

Carol G

I am opening a dialog form to get some information. Then closing the dialog
form when done.
The problem I am having is that the sometimes I push the command button to
open the form it runs through the if is loaded section without giving me the
opportunity to fill in the choices on the dialog form. If I push the command
button again, it operates correctly and lets the user enter choices.
Thanks,

Carol

Code snippet..
If strNameList <> "" Then
DoCmd.OpenForm "frmDuplicateValue", OpenArgs:=strNameList,
WindowMode:=acDialog
'Stop here and wait until form goes away

If IsLoaded("frmDuplicateValue") Then
If Forms("frmDuplicateValue").Tag <> "New" Then
strDecision = Forms("frmDuplicateValue").Tag
Debug.Print "Will update " & strDecision
DoCmd.Close acForm, "frmDuplicateValue"

'Enter Code to update contact here
MsgBox "Must place code to update here."

Else
 
K

Ken Snell \(MVP\)

Is frmDuplicateValue actually being closed when you're done with it, or is
it just being made invisible? Your code suggests the latter case, which is
fine, so long as you're sure that the form is always closed by the code when
you're done reading the value from it. Look carefully at your code's logic
to be sure that your code will always close the form no matter what. The
behavior that you describe is typical of the form not being closed and
remaining in invisible (hidden) mode when the code is run again the next
time.
 

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

Top