S
silva
I have implemented a command button in a continuous form that'll open a
detailed report based on the small amount of overview data on the form. The
problem I'm having is properly limiting the report to the desired, relevant
data. If I use text fields in the conditional portion of the command, it
works, but it displays too many records. As it is the text fields alone do
not have any data that'll single out one record. I tried to use a field with
a date format or an autonumber field named eventID, but all I get when I use
those is an error message that says "Data type mismatch in query expression".
Is there anything I need to do with the query powering the report, or does
the conditional statements in the command button only work with text fields?
I've tried creating a variable as a LONG and storing the autonumber in it and
using it, but that seems to be an incorrect approach.
Here's a code snippet if it'll help identify what I'm doing wrong:
Dim transID As Long
transID = [contact_autonumber]
stDocName = "generic_report"
DoCmd.OpenReport stDocName, acPreview, , ("contact_autonumber = '" &
transID & "'")
detailed report based on the small amount of overview data on the form. The
problem I'm having is properly limiting the report to the desired, relevant
data. If I use text fields in the conditional portion of the command, it
works, but it displays too many records. As it is the text fields alone do
not have any data that'll single out one record. I tried to use a field with
a date format or an autonumber field named eventID, but all I get when I use
those is an error message that says "Data type mismatch in query expression".
Is there anything I need to do with the query powering the report, or does
the conditional statements in the command button only work with text fields?
I've tried creating a variable as a LONG and storing the autonumber in it and
using it, but that seems to be an incorrect approach.
Here's a code snippet if it'll help identify what I'm doing wrong:
Dim transID As Long
transID = [contact_autonumber]
stDocName = "generic_report"
DoCmd.OpenReport stDocName, acPreview, , ("contact_autonumber = '" &
transID & "'")