Single Page Report direct from form button

Ade F

Avid Listener
Local time
Today, 17:58
Joined
Jun 12, 2003
Messages
97
Ok people I appreciate that their are access guru's just waiting to pounce on the newbie access developers but here goes.

I have developed a small ordering system and wish to place a button directly into the form. The form is the actual purcase order that an employee would fill in previous to sending off to a supplier (via winfax).

My question is how would I go about creating a button that previews ONLY that specific page the user is situated in at the time of ordering. At the moment I can create a satisfactory report for the Orders only ALL of orders are displayed when clicking the button. I wish for only the current single page to be displayed.

My main variable for this action would be ORDER ID. The button must activate the formatted report and not ask for the ORDER ID either as this could cause more confusion amongst the employees. It would have to be one simple button operation or nothing.

If anybody could provide me with some solid code examples or help this would be excellent. I appreciate their are possibly several different ways of approaching this problem but the more the merrier. If it means completely re-designing forms or reports then so be it I would just like to get the one nailed down once and for all.

Many thanks people.

purchase%20order.jpg


This is a capture of the order form. Yes I have used datasheet for product selection but it is easier for copying and pasting previous order information. Continuous forms appear to be more presentable and robust (no re-sizing) but less flexible for data copying (a lot of employees like to create new purchase orders whilst retaining product order entries due to repeat manufacturing requirements).
 
Last edited:
Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "YourReport"

stLinkCriteria = "[CustID]=" & Me![txtAlph]
DoCmd.OpenReport stDocName, , , stLinkCriteria
'where txtAlph is the textbox on your form that contains your customerID
 
Thanks but a little information needed

Presumably I would just create a button and insert this code to create the report action. I will elaborate on the build of my form when a new purchase order is created an text box autonumber is generated (ORDERID). Does this mean that the following code would be appropriate

Dim stDocName As String
Dim stLinkCriteria As String

stDocName = "Orders"

stLinkCriteria = "[OrderID]=" & Me![OrderID]
DoCmd.OpenReport stDocName, , , stLinkCriteria

If so then I have tried this and I just get the message "could not print your report". I have checked that the report name is correct on line 3 of the code.
 
That's the trouble with answering questions before the coffee's taken hold;)
Dim stDocName As String

stDocName = "Orders"
DoCmd.OpenReport stDocName, acNormal, , "[OrderID] = " & Me![OrderID]
replace acNormal with acPreview if required
 
Problem Solved

Thanks Rich you are a star.

It worked like a charm.

You da man.
 
I added the Code and when i use the button i get a "missing operator" syntax error un der the unique query. I see a refference to the linkcriteria, ahould that be in there anywhere?
 

Users who are viewing this thread

Back
Top Bottom