I have a problem opening a form filtered to a particular record. The form is opened by obtaining a values for respondentID, QuestionnaireID and ResponseSessionDate in a dialog. When all selections are made these are used to identify the record in ResponseSession using a DLookup. The combination of values obtained is unique.
Using the dialog I can open the form for some records correctly, whereas for others it does not.
The Dlookup is:
Used to open the form as:
Using tracing, intSessionID is "0" for some records (where the form does not load data) however a valid record id is returned for others. In both cases the 3 criteria passed are valid values. I can't see why in some cases it works in others it does not.
Data in the ResponseSessions table show the record exists.
The query for the target form shows records corresponding to the records in the ResponseSessions table.
Any suggestions?
Using the dialog I can open the form for some records correctly, whereas for others it does not.
The Dlookup is:
Code:
intSessionID = Nz(DLookup("ResponseSessionID", "ResponseSessions", "RespondentID = " & intRespondentID _
& " AND QuestionnaireID = " & intQuestionnaireID _
& " AND ResponseSessionDate = #" & cboResponseDate & "#"), 0)
Used to open the form as:
Code:
DoCmd.OpenForm "frmQSession", , , "[ResponseSessionID] = " & intSessionID
Using tracing, intSessionID is "0" for some records (where the form does not load data) however a valid record id is returned for others. In both cases the 3 criteria passed are valid values. I can't see why in some cases it works in others it does not.
Data in the ResponseSessions table show the record exists.
The query for the target form shows records corresponding to the records in the ResponseSessions table.
Any suggestions?