Can anyone help with passing a value to a report

secondangel

Registered User.
Local time
Today, 08:50
Joined
Nov 6, 2008
Messages
52
Hiya

HAving trouble getting a report to open filtered on a value from my form

In the form is a dropdown combo box that selects the customers name
A text box at teh side retrives the value of the customers id number which is the second field in the combo box.

Then the report is meant to take the value from the text box (cs) as the filter against the id.

The report is made from a query.

Any idea as to why i get

Microsoft access cant find the field ¦


Code:
DoCmd.OpenReport stDocName, acPreview, , [CustomerID] = Forms![CustomerMaintenance]![cs]


The way round is to just use the combo box with a list of customer id numbers and choose from that - but its easier to search by name.

Any help appreciated as always
 
Code:
linkcriteria = "[CustomerId]= '" & Me![cs] & "'"
    DoCmd.OpenReport "AllCustomersOrders", acPreview, , lincriteria

USed your code - thanks for the correct syntax - i dont get an error - however the filtering doesnt work. I get every record rather than filtered by the Customer Id

Any ideas
 
If that's a cut and paste, you've misspelled the variable.
 
If that's a cut and paste, you've misspelled the variable.

thanks, spelled linkcriteria wrong

still doenst do the trick.

i get a blank report now, regardless of which number is selected.
 
If cs is a combo box, make sure the bound column is the value expected by the report. Can you post the db?
 
yes cs is a combox, its got 2 columns and the bound column is set to 2, the value i want as the first column is the customers name.

ill attach. many thanks for looking. its like half 9 at night here - still at work on it :-( guess im not as good at access as i thought. crazy when i can do recordset manipulation in VB.
 
It appears to work as I would expect. You can only test with customers 3 or 8, since they're the only ones returned by the query (only ones with orders). Anyone else will come up blank.
 
cant believe it. it works. and before it didnt even give me anything. just blank or all of them?

yes ur right it works exactly as expected.



im so sorry / embarrased

:-(
 
No need to be sorry or embarrassed; computers do quirky things sometimes.
 

Users who are viewing this thread

Back
Top Bottom