First thing is may I strongly advise not having spaces in the names of forms, tables, queries, controls or field.
Equally Expenses Table is a very misleading name for a form, something like FrmExpenses would be much clearer.
That said, we have two separate processes.
Let us assume you have a field in your FrmExpenses called MissingDataID, and the form you want to open to enter the required information is called FrmMissingData.
This is the code you need on the double click.
-
Private Sub MissingDataID_DblClick(Cancel As Integer)
-
-
If Not CurrentProject.AllForms("FrmMissingData").IsLoaded Then
-
DoCmd.OpenForm "FrmMissingData"
-
End If
-
-
DoCmd.SelectObject acForm, "FrmMissingData"
-
DoCmd.Restore
-
If Nz(MissingDataID) = 0 Then
-
DoCmd.GoToRecord acForm, "FrmMissingData", acNewRec
-
Else
-
DoCmd.GoToControl "MissingDataID"
-
DoCmd.FindRecord MissingDataID
-
End If
-
-
End Sub
-
It opens the form and optionally restores it. If there is a value in the MissingDataID field in the main form, it opens the new form at that record so that it can be edited.
If there is no value in the MissingDataID field in the main form, it opens the new form at a new record record so that you can add the new data.
Then after you update or add the new record you use this code
-
Private Sub Form_AfterUpdate()
-
-
With Forms(FrmExpenses)
-
If !MissingDataID <> MissingDataID Then
-
!MissingDataID = 0
-
!MissingDataID.Requery
-
!MissingDataID = MissingDataID
-
End If
-
End With
-
-
EndSub
-
That should load the new value back to the FrmExpenses.
Phil