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!

Calling Procedure cancels save action. HELP 1

Status
Not open for further replies.

dmon000

Technical User
Sep 9, 2003
79
US

The code below is from a command button to save the contents of a form to a new record. It worked fine until I added the call statement afterwards. Why would that cancel the save?
The procedure in the call statement does execute after the save.

Private Sub cmdClickToContinue_Click()
On Error GoTo Err_cmdClickToContinue_Click


DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
Call AddPatientToWard

Exit_cmdClickToContinue_Click:
Exit Sub

Err_cmdClickToContinue_Click:
MsgBox Err.Description
Resume Exit_cmdClickToContinue_Click

End Sub
 
And what does this AddPatientToWard procedure ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
The AddPatientToWard procedure is as follows:
Why would adding this after the save in the Private Sub cmdClickToContinue_Click() event above cancel the save?

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 acForm, "frm Roster Diet Orders"
DoCmd.OpenForm "frm Roster Diet Orders", acNormal, , , , acWindowNormal
Exit_AddPatientToWard:
Exit Sub
 
The 3rd argument of your DLookUp call seems incomplete.

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

Part and Inventory Search

Sponsor

Back
Top