I have a form that is called from a parent form.
The parent form shows booking for an event and the child form shows the payments made for the currently selected booking.
The child form fJDWEventPay Record Source is table tJDWPayments
The key field is jdwp_BookingRef. This is an unique reference that matches a booking to the payments.
The pertinent code follows:
Dim stDocName As String
Dim stLinkCriteria As String
stLinkCriteria = "tJDWPayments.jdwp_BookingRef =" & lngBookingID
lngNoPayments = DCount("jdwp_BookingRef", tJDWPayments","jdwp_BookingRef=" & lngBookingID)
stDocName = "fJDWEventPay"
DoCmd.OpenForm stDocName, , , stLinkCriteria, , acDialog
In debugging the code I observe that:
lngNoPayments = 3 – this is correct and verified by opening the table and setting the filter to ‘jdwp_BookingRef=11211’
stLinkCriteria = “tJDWPayments.jdwp_BookingRef=11211”
Yet when fJDWEventPay opens it shows only one record. The record does match the filter in that the booking ref is 11211.