S
Scott
I am trying to get a report to open with data that is from a record that is
on a form. The command button is on the form and the report is supposed to
open filtered to the id of the record on the form. It is a simple thing, but
for some reason it is not behaving as I would expect. The name of the form
is InfoData and the name of table from which the form gets the ID I need is
TblVolInfo.
The code is:
Dim stOpenReport as string
Dim stLinkCriteria as string
stOpenReport = "Volunteer Info"
stLinkCriteria = "Person_PlaceID = " & Me!Person_PlaceID
Then it goes to the SQL statement that opens the form.
The code stops at where it is trying to put the Person_PlaceID in the
variable. It says it is unable to find the referenced field. I tried a
number of variations on the reference, including
Me!TblVolInfo.Person_PlaceID, Forms!InfoData.Person_PlaceID, etc. and I get
virtually the same result.
I was able to work around it by creating a control on the form called ID
whose source is Person_PlaceID and changing the code to say:
stLinkCriteria = "Person_PlaceID = " & Me!ID
I then hide the control on the form because it is superfluous for users.
But it seems to me that the code above should work. Any suggestions?
on a form. The command button is on the form and the report is supposed to
open filtered to the id of the record on the form. It is a simple thing, but
for some reason it is not behaving as I would expect. The name of the form
is InfoData and the name of table from which the form gets the ID I need is
TblVolInfo.
The code is:
Dim stOpenReport as string
Dim stLinkCriteria as string
stOpenReport = "Volunteer Info"
stLinkCriteria = "Person_PlaceID = " & Me!Person_PlaceID
Then it goes to the SQL statement that opens the form.
The code stops at where it is trying to put the Person_PlaceID in the
variable. It says it is unable to find the referenced field. I tried a
number of variations on the reference, including
Me!TblVolInfo.Person_PlaceID, Forms!InfoData.Person_PlaceID, etc. and I get
virtually the same result.
I was able to work around it by creating a control on the form called ID
whose source is Person_PlaceID and changing the code to say:
stLinkCriteria = "Person_PlaceID = " & Me!ID
I then hide the control on the form because it is superfluous for users.
But it seems to me that the code above should work. Any suggestions?