Passing parameter to report from command button

foxy

Registered User.
Local time
Today, 23:06
Joined
Feb 17, 2009
Messages
64
Hi,

I have a report that diplays info on a single person. It has a parameter of 'Person ID'.

I also have a continuous form which displays a list of people from the database with a command button on each row for each person.

I want to be able to click on the command button on a single row and pass that per_id to the parameter on the report.

I have the following VBA so far:

Code:
DoCmd.OpenReport "rptWholePerson", acViewReport, , "[Person ID] = Me.[per_id]"

But when I click the command button I still get prompted for the parameter??

Any suggestions?

Cheers

Foxy
 
DoCmd.OpenReport "rptWholePerson", acViewReport, , "[Person ID] = " & Me.[per_id]

???
 
Shouldn't that be Me! :confused:
 
DoCmd.OpenReport "rptWholePerson", acViewReport, , '"[Person ID]=" & Me.per_id'

??????

person_id = Me.per_id
DoCmd.OpenReport "rptWholePerson", acViewReport, , '"[Person ID] = " & person_id'

??????

Its just getting the right syntax ?
 
It might be this , quotes, [person ID] = single quote, quotes, & Me.[per_id], quotes, single quote, quotes.

So, DoCmd.OpenReport "rptWholePerson", acViewReport, , "[Person ID] = '" & Me.[per_id]"'"

so its parsed correctly.

gregorg.
 
DoCmd.OpenReport "rptWholePerson", acViewReport, , "[Person ID] = '" & Me.[per_id]"'"

so if person id is 4

it looks like this to the report

[Person ID] = '4'
 
DoCmd.OpenReport "rptWholePerson", acViewReport, , "[Person ID] = '" & Me.[per_id]"'"

so if person id is 4

it looks like this to the report

[Person ID] = '4'

Hi,

Tried this and its still prompting me for the parameter, its really baffling me why its not working!
 
Dont know, can you try to msgbox me.per_id ????? or mgsbox "[Person ID] = '" & Me.[per_id]"'"

????
 
"[Person ID] = " & Me![per_id]
 
Sounds like you may have a parameter associated to your Query on the actual report. You don't need a query parameter on the report since you are passing the parameter in the OpenReport command.
 
question - because the parameter is off the form ?
 

Users who are viewing this thread

Back
Top Bottom