I have a master form, 'PATIENTS' from which I open a linked form 'SERVICES'
using a button with OpenForm using a WHERE filter:
Private Sub btnAddServices_Click()
Dim openCriteria As String
openCriteria = "[RecNum]= " & Me.[RecNum] & "AND [Admitdate] = " & "#" &
Me.[Admitdate] & "#"
DoCmd.OpenForm "SERVICES", , , openCriteria
This works fine and opens the SERVICES form with the correct records showing.
However, if there are no records to show, I'd like to open 'SERVICES' on a
new, empty record. I tried adding the following to the SERVICES' Load event:
If Not Me.NewRecord Then
but SERVICES then opens on a new record with the default values for 'RecNum'
and 'Admitdate' rather than the values visible on the calling form,
'PATIENTS'. How do I ensure that the new record has the non-default values
entered when 'SERVICES' opens?