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
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