Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

PRINT A SINGLE RECORD from A FORM........

Status
Not open for further replies.

1318

Technical User
Nov 26, 2001
22
ID
I try to print a single record from a form into a report with WHERE clause in DoCmd.OpenReport.

the Command look likes this. ( I pick this command method from +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
DoCmd.OpenReport "rptProd_Data", acViewPreview, , "[Item_Number] = Forms!"Add/Edit Product!Item_Number"

' "rptProd_Data" is my report
' "Item_Number" is a fieldname in the record as the primary key
' "Add/Edit product " is my form name
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The problem is when I click the Button, is came out "Enter Parameter Value" windows.

Please help to solve this problem.

Thanks before.

P2
 
Access can't find the parameter you specified because of improper syntax so it opens the input parameter window.

You have an extra " mark after Forms!

AvGuy
 
1318:

Try,

DoCmd.OpenReport "rptProd_Data", acViewPreview, , "[Item_Number]=" & Forms!Add/Edit Product!Item_Number

Couple of things: If the item_Number is a number type, then you OK. If the item_number is text, then use:

DoCmd.OpenReport "rptProd_Data", acViewPreview, , "[Item_Number]='" & Forms!Add/Edit Product!Item_Number & "'"


Another thought,

DoCmd.OpenReport "rptProd_Data", acViewPreview, , "[Item_Number]=" & Me![Item_Number]

The Me in this case is the form you are opening the report from, so make sure that field is located on the form also.


That's my .02, Good Luck

 
Hi rickgrimes,

I try copy and paste the command
DoCmd.OpenReport "rptProd_Data", acViewPreview, , "[Item_Number]='" & Forms!Add/Edit Product!Item_Number & "'"
but there is a syntax error message.
Something wrong with it or I did it in wrong way ?

Regards,
P2
 
try bracketing the Form Name
[Add/Edit]


PaulF
 
Thanks Paul and Everyone,
It's works now.:)

Regards,
Nugie
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top