I have used the following codes in shipperID combo box double click event. after adding the record to shipper form save, and close the added record is not available in shipperID combo box drop items.
Private Sub ShipperID_DblClick(Cancel As Integer)
Dim rs As DAO.Recordset
Dim strWhere As String
Const strcTargetForm = "frmShipper"
'Set up to search for the current customer.
If Not IsNull(Me.ShipperID) Then
strWhere = "ShipperID = """ & Me.ShipperID & """"
End If
'Open the editing form.
If Not CurrentProject.AllForms(strcTargetForm).IsLoaded Then
DoCmd.OpenForm strcTargetForm
End If
With Forms(strcTargetForm)
'Save any edits in progress, and make it the active form.
If .Dirty Then .Dirty = False
.SetFocus
If strWhere <> vbNullString Then
'Find the record matching the combo.
Set rs = .RecordsetClone
rs.FindFirst strWhere
If Not rs.NoMatch Then
.Bookmark = rs.Bookmark
End If
Else
'Combo was blank, so go to new record.
RunCommand acCmdRecordsGoToNew
End If
End With
Set rs = Nothing
End Sub
looking for a solution
foxtet
Private Sub ShipperID_DblClick(Cancel As Integer)
Dim rs As DAO.Recordset
Dim strWhere As String
Const strcTargetForm = "frmShipper"
'Set up to search for the current customer.
If Not IsNull(Me.ShipperID) Then
strWhere = "ShipperID = """ & Me.ShipperID & """"
End If
'Open the editing form.
If Not CurrentProject.AllForms(strcTargetForm).IsLoaded Then
DoCmd.OpenForm strcTargetForm
End If
With Forms(strcTargetForm)
'Save any edits in progress, and make it the active form.
If .Dirty Then .Dirty = False
.SetFocus
If strWhere <> vbNullString Then
'Find the record matching the combo.
Set rs = .RecordsetClone
rs.FindFirst strWhere
If Not rs.NoMatch Then
.Bookmark = rs.Bookmark
End If
Else
'Combo was blank, so go to new record.
RunCommand acCmdRecordsGoToNew
End If
End With
Set rs = Nothing
End Sub
looking for a solution
foxtet