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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open/Close Form from Module 1

Status
Not open for further replies.

dmon000

Technical User
Sep 9, 2003
79
US
HI,
The following Module code executes fine except the two lines that try to open and close a form "frm Roster Diet Orders". It just won't do it. I gave up on trying to requery the form and thought that just opening and closing would be easier.

What am I doing wrong?

And thanks for all the earlier help!!!


Sub AddPatientToWard()
On Error GoTo Err_AddPatientToWard

DoCmd.SetWarnings False
DoCmd.Close acForm, "frmMPInumber"

If (Nz(DLookup("mpi", "qryShowMPI", "mpi"), 0) = 0) Then
DoCmd.OpenForm "frm Add New Patient", , , , , acWindowNormal

Else
DoCmd.OpenQuery "qry Add to Ward"
End If
DoCmd.OpenQuery "qryDeleteMPINumberRecord"
DoCmd.Close Form = acDefault, "Forms!frm Roster Diet Orders"
DoCmd.OpenForm "frm Roster Diet Orders", acNormal, , , , acWindowNormal
Exit_AddPatientToWard:
Exit Sub

Err_AddPatientToWard:
MsgBox Err.Description
Resume Exit_AddPatientToWard

End Sub
 
Replace this:
DoCmd.Close Form = acDefault, "Forms!frm Roster Diet Orders"
with this:
DoCmd.Close acForm, "frm Roster Diet Orders"


BTW, your criteria in DLookUp call seems suspect to me ...

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top