More docmd.openreport aggravation

tweetyksc

Registered User.
Local time
Today, 14:47
Joined
Aug 23, 2001
Messages
87
I'm sure I'm doing something simple wrong...but what?

Here's the code:

------------------------------------
Select Case grpBPInfo
Case 1
stDocName = "BPInfo"
stcondition = "[CostCenter]=" & Me![cboCUS]
Case 2
stDocName = "BPInfo"
stcondition = "[AKACostCenter] = " & Me![cboCC]
Case 3
stDocName = "BPsbyCC"
Case 4
stDocName = "BPsbyCUS"
Case 5
stDocName = "BPsNoCostCenter"
'stcondition = "[AKACostcenter] = " &""
End Select

DoCmd.OpenReport stDocName, acPreview, , stcondition
--------------------------------

For Option 1 - I need to pull the record that has "costcenter" field that matches the value from the combo box cboCUS on the form.
What I'm getting is a parameter prompt with the value of the combo box as the prompt. Ditto with Option 2 - which runs the report but for a different field filter/different combo box.

Case 5, I'm trying to run a report with "AKACostCenter" blank.

Sigh. What am I doing wrong??
I'm trying to avoid having upteen queries for the customer file section of this database...I finally got the Item queries narrowed from 10 to ONE!
 
Maybe this is it...

If your fields are text, then you'll have to include single quotes

stcondition = "[CostCenter]='" & Me![cboCUS] & "'"

hope this helps,
Maria
 
That was it! Thanks.
 

Users who are viewing this thread

Back
Top Bottom