M
magicdds-
I have the following code on the ACCEPT command button on the form
PATIENTINFOENTRY:
Private Sub Accept_Click()
On Error GoTo Err_Accept_Click
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm "Main", acNormal, "",
"[PatientID]=[Forms]![PatientInfoEntry]!_[PatientID]", acEdit, acNormal
DoCmd.Close acForm, "PatientInfoEntry"
Forms!Titlebar!Patient.Requery
Exit_Accept_Click:
Exit Sub
Err_Accept_Click:
MsgBox Err.Description
Resume Exit_Accept_Click
End Sub
This code should open the form MAIN showing the record for the patient whose
information was just entered in the form PATIENTINFOENTRY, Close the form
PATIENTINFOENTRY, add the patient's name to a combobox in the form TITLEBAR.
This seemed to work fine until I open a form to add a charge to the patient
record. When I close the form CHARGE, a box pops up asking me for
[Forms]![PatientInfoEntry]![PatientID]. Remember, the form PatientInfoEntry
has already been closed.
If I delete the line
DoCmd.OpenForm "Main", acNormal, "",
"[PatientID]=[Forms]![PatientInfoEntry]!_[PatientID]", acEdit, acNormal
and open the form MAIN from the form TITLEBAR (in the combobox, select the
patient's name & the form Main opens to that patient's record), everything
works smoothly.
The question is, why would the code try to open the form a second time after
the form PATIENTINFOENTRY has been closed for some time already?
Any ideas would be appreciated.
Thanks
Mark
PATIENTINFOENTRY:
Private Sub Accept_Click()
On Error GoTo Err_Accept_Click
DoCmd.RunCommand acCmdSaveRecord
DoCmd.OpenForm "Main", acNormal, "",
"[PatientID]=[Forms]![PatientInfoEntry]!_[PatientID]", acEdit, acNormal
DoCmd.Close acForm, "PatientInfoEntry"
Forms!Titlebar!Patient.Requery
Exit_Accept_Click:
Exit Sub
Err_Accept_Click:
MsgBox Err.Description
Resume Exit_Accept_Click
End Sub
This code should open the form MAIN showing the record for the patient whose
information was just entered in the form PATIENTINFOENTRY, Close the form
PATIENTINFOENTRY, add the patient's name to a combobox in the form TITLEBAR.
This seemed to work fine until I open a form to add a charge to the patient
record. When I close the form CHARGE, a box pops up asking me for
[Forms]![PatientInfoEntry]![PatientID]. Remember, the form PatientInfoEntry
has already been closed.
If I delete the line
DoCmd.OpenForm "Main", acNormal, "",
"[PatientID]=[Forms]![PatientInfoEntry]!_[PatientID]", acEdit, acNormal
and open the form MAIN from the form TITLEBAR (in the combobox, select the
patient's name & the form Main opens to that patient's record), everything
works smoothly.
The question is, why would the code try to open the form a second time after
the form PATIENTINFOENTRY has been closed for some time already?
Any ideas would be appreciated.
Thanks
Mark