P
Pam Ammond
I am trying to update a combo box (PartID) on the subform after going to
another form (frmPart) to enter the new value into the table (tblPart) used
as the source for the combo box.
Yes, I HAVE used code from other posts in this forum and spent 3 days trying
to play with the code to get it to work.
It doesn't give any errors when it runs, but the combo box dropdown on the
subform doesn't show the new value, although the value is in the database.
To get the new value in the combo box dropdown I have to escape out of the
subform line, go to the main form, and then come back to the subform.
Here's the relevant code:
Private Sub PartID_GotFocus()
Me![PartID].Undo
DoCmd.RunCommand acCmdSaveRecord
Me![PartID].Form.Requery
Me![PartID].Requery
End Sub
Private Sub PartID_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_PartID_NotInList
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPart"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Exit_PartID_NotInList:
Exit Sub
Err_PartID_NotInList:
MsgBox Err.Description
Resume Exit_PartID_NotInList
End Sub
Thanks in advance,
Pam
another form (frmPart) to enter the new value into the table (tblPart) used
as the source for the combo box.
Yes, I HAVE used code from other posts in this forum and spent 3 days trying
to play with the code to get it to work.
It doesn't give any errors when it runs, but the combo box dropdown on the
subform doesn't show the new value, although the value is in the database.
To get the new value in the combo box dropdown I have to escape out of the
subform line, go to the main form, and then come back to the subform.
Here's the relevant code:
Private Sub PartID_GotFocus()
Me![PartID].Undo
DoCmd.RunCommand acCmdSaveRecord
Me![PartID].Form.Requery
Me![PartID].Requery
End Sub
Private Sub PartID_NotInList(NewData As String, Response As Integer)
On Error GoTo Err_PartID_NotInList
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "frmPart"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormAdd
Exit_PartID_NotInList:
Exit Sub
Err_PartID_NotInList:
MsgBox Err.Description
Resume Exit_PartID_NotInList
End Sub
Thanks in advance,
Pam