potts
Registered User.
- Local time
- Today, 00:03
- Joined
- Jul 24, 2002
- Messages
- 87
I have been using the following code to update information populating a combo box, e.g. if I enter "eggs" and it is not a stored term, I get asked if I want to add it, and then the combo box is updated accordingly.
'In the data entry form ...
Private Sub JournalID_NotInList(NewData As String, Response As Integer)
If vbYes = MsgBox("The journal '" & NewData & "' is not in the journal list. " & _
" Do you want to add it?", vbQuestion + vbYesNo) Then
DoCmd.OpenForm "frmSource", acNormal, , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
Else
Response = acDataErrDisplay
End If
End Sub
'In the "frmSource" form ...
Private Sub Form_Load()
If Not IsNothing(Me.OpenArgs) Then
Me!Journal = Me.OpenArgs
Me.SetFocus
DoCmd.Close
End If
End Sub
This has worked fine for me on a number of occasions. However, I now need to update two fields in the frmSource form and I can't get it to work.
I have tried removing the DoCmd.Close line, entering the data in the second field manually and then closing the form, but although the underlying table of "frmSource" is updated, the combo box on the data entry form is not updated unless I close the form and open it again.
Does anyone know how I might fix this?
'In the data entry form ...
Private Sub JournalID_NotInList(NewData As String, Response As Integer)
If vbYes = MsgBox("The journal '" & NewData & "' is not in the journal list. " & _
" Do you want to add it?", vbQuestion + vbYesNo) Then
DoCmd.OpenForm "frmSource", acNormal, , , acFormAdd, acDialog, NewData
Response = acDataErrAdded
Else
Response = acDataErrDisplay
End If
End Sub
'In the "frmSource" form ...
Private Sub Form_Load()
If Not IsNothing(Me.OpenArgs) Then
Me!Journal = Me.OpenArgs
Me.SetFocus
DoCmd.Close
End If
End Sub
This has worked fine for me on a number of occasions. However, I now need to update two fields in the frmSource form and I can't get it to work.
I have tried removing the DoCmd.Close line, entering the data in the second field manually and then closing the form, but although the underlying table of "frmSource" is updated, the combo box on the data entry form is not updated unless I close the form and open it again.
Does anyone know how I might fix this?