Larry,
Thanks for the information. There are a few issues here. First of all,
as I understand it, the criteria to restrict your report data to the
Observer_Text on the form, is already taken care of in the query. So it
seems to me that any Where Condition in the OpenReport code that
attempts to do the same thing is totally redundant and can be dispensed
with. Mind you, there is a confusion in your description, which is that
the control on the form where you are referring for your criteria is
Observer_Text whereas the SQL of the query shows it as
PPE_Observer_Text, so I'm not sure what's going on here.
However, assuming it is correct to use a Where Condition in the
OpenReport code, you have the syntax wrong, which is what the error
message is all about. I think it should be like this...
DoCmd.OpenReport "Z_PPE_Compliance_Audit_Report", acViewPreview, ,
"[PPE_Observer]=" & strWhereCategory
I could not follow the purpose of your data manipulations. It looks
like you end up with the same value assigned to Combo93,
PPE_Observer_Text, PPE_Observer_2, Text100, and strWhereCategory. Why?
Wouldn't it be just as easy to leave all of that out, and just do like
this?...
DoCmd.OpenReport "Z_PPE_Compliance_Audit_Report", acViewPreview, ,
"[PPE_Observer]='" & Me.Combo93 & "'"
--
Steve Schapel, Microsoft Access MVP
Steve,
I've just pasted the last line in the SQL view that my Report is linked to,
there's lots of stuff but nothing unique. I think its the [] that's halting
the query and asking for a Parameter. But I don't know what to do about it.
FROM Z_PPE_Audit_Table_Alternate
WHERE
((([Z_PPE_Audit_Table_Alternate].[PPE_Observer])=[Forms]!Supervisors_Safety_Log_Control_Panel!PPE_Observer_Text));
Supervisors_Safety_Log_Control_Panel is the Form where I have a Text Box
called "Ovserver_Text"; I'm populating that Text field with a Combo Box
that's on the same Form. The Query is pulling data from only one Table -
"Z_PPE_Audit_Table_Alternate". Nothing fancy about it.
Shown here is the VB Code that I've been trying to make work. It does
everything that it is suppose to until it gets to the last line. The
"strWhereCategory" register contains the right information but I get an error
3075: Syntax error(missing operator) in query expression '(Jerry Potter)'.
Note that "Jerry Potter" is the info that's in the "strWhereCategory".
Thanks,
Larry
Private Sub Combo93_Click()
Me!PPE_Observer_Text = Me!Combo93
Me!PPE_Observer_2 = Me!PPE_Observer_Text
Me!Text100 = Me!PPE_Observer_Text
Dim strWhereCategory As String
strWhereCategory = Me!Text100
DoCmd.OpenReport "Z_PPE_Compliance_Audit_Report", acPreview, ,
strWhereCategory
End Sub