open rpt, asking for parmeter value

dhunter

Registered User.
Local time
Today, 07:51
Joined
Jul 1, 2009
Messages
26
From a form I am allowing a user to choose a customer in a combo box. Users press button Make Report and it should open the report with correct customer. However when you press the button it asks for CustChoice parameter value (even though when code is stopped and you hover over CustChoice it's value is correct). Can someone please help me?

Here is my code:

Private Sub Make_Report_Click()
On Error GoTo Make_Report_Click_Err
Dim CustChoice

If Me.Customer.Value = Null Then
CustChoice = 1
Else
CustChoice = Me.Customer.Value
DoCmd.OpenReport "rpt_Customer", acViewReport, "Customer", "Customer = CustChoice", acNormal
End If
 
Now instead of displaying "CustChoice enter a value" parmeter value box says "Adims enter a vale" (adims is the name of the customer so that's correct) but it still shouldn't be asking for a parmeter value.
<< scratches head
 
What is "Customer" in the filter argument? It seems odd to use both arguments.
 
Customer is the field i want the report to be sorted by, the second customer = custchoice is the actual customer i want to it filter. i tried...

DoCmd.OpenReport "rpt_Customer", acViewReport, "Customer = " & CustChoice, acNormal

but then the report was blank, however i didn't get a pop-up asking for a parmeter value.
 
I think you have the arguments out of position. Try

DoCmd.OpenReport "rpt_Customer", acViewReport, ,"Customer = " & CustChoice
 
I really appreciate the help.
I tried and same as before, pop box asking for parmeter value. If I type in the customer in the parameter value pop up it brings up the report correctly, I don't understand why I keep getting the pop up box.
 
Can you post the db?
 
If Customer is text then

DoCmd.OpenReport "rpt_Customer", acViewReport, ,"Customer = " & Chr(34) & CustChoice & Chr(34)
 

Users who are viewing this thread

Back
Top Bottom