Dear Friends,
I have used the following codes in FlightID combo box double click event. after adding the record to Floght form save, and close the added record is not available in FlightID combo box drop items.
Private Sub FlightID_DblClick(Cancel As Integer)
Dim rs As DAO.Recordset
Dim strWhere As String
Const strcTargetForm = "frmFlight"
'Set up to search for the current customer.
If Not IsNull(Me.FlightID) Then
strWhere = "FlightID = """ & Me.FlightID & """"
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
I have used the following codes in FlightID combo box double click event. after adding the record to Floght form save, and close the added record is not available in FlightID combo box drop items.
Private Sub FlightID_DblClick(Cancel As Integer)
Dim rs As DAO.Recordset
Dim strWhere As String
Const strcTargetForm = "frmFlight"
'Set up to search for the current customer.
If Not IsNull(Me.FlightID) Then
strWhere = "FlightID = """ & Me.FlightID & """"
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