Pangloss14
Registered User.
- Local time
- Today, 00:11
- Joined
- May 30, 2003
- Messages
- 19
Hi,
I've spent the last few hours searching through old posts so hopefully this isn't already answered somewhere. Anyhow, I have a form whose data source is the table that I want to update. The table consists of 4 fields, ID, First and Last Name, DOB. I have a combo box that looks up the related fields. If the entered ID doesn't exist, then the NotInList event is triggered which loads a subform to enter the required information.
My problem is that upon return to the main form, the new ID is shown in the combo box but the related fields aren't updated when I select the new value in the combo box. I'm guessing that I need to requery or something but I've run into an error saying that I need to save the current field before requerying (error 2118).
Here is the relevant code (Access 2000).
'frmPatient
Private Sub Combo12_NotInList(NewData As String, Response As Integer)
If MsgBox("Would you like to add new patient?", vbYesNo + vbQuestion, _
"Patient not found") = vbYes Then
DoCmd.OpenForm "frmNewPatient", acNormal, , , acAdd, acDialog, NewData
Response = acDataErrAdded
DoCmd.Close acForm, "frmNewPatient"
Else
Response = acDataErrContinue
End If
End Sub
' Form frmNewPatient
Private Sub Form_Load()
Me.APHC = Me.OpenArgs
End Sub
Regards,
John
I've spent the last few hours searching through old posts so hopefully this isn't already answered somewhere. Anyhow, I have a form whose data source is the table that I want to update. The table consists of 4 fields, ID, First and Last Name, DOB. I have a combo box that looks up the related fields. If the entered ID doesn't exist, then the NotInList event is triggered which loads a subform to enter the required information.
My problem is that upon return to the main form, the new ID is shown in the combo box but the related fields aren't updated when I select the new value in the combo box. I'm guessing that I need to requery or something but I've run into an error saying that I need to save the current field before requerying (error 2118).
Here is the relevant code (Access 2000).
'frmPatient
Private Sub Combo12_NotInList(NewData As String, Response As Integer)
If MsgBox("Would you like to add new patient?", vbYesNo + vbQuestion, _
"Patient not found") = vbYes Then
DoCmd.OpenForm "frmNewPatient", acNormal, , , acAdd, acDialog, NewData
Response = acDataErrAdded
DoCmd.Close acForm, "frmNewPatient"
Else
Response = acDataErrContinue
End If
End Sub
' Form frmNewPatient
Private Sub Form_Load()
Me.APHC = Me.OpenArgs
End Sub
Regards,
John