nasty field name that (presuming [Why - Why #] is a field in the table
it is prefferable not to use special characters (space, -, etc in field
names)
better to use the caption property
Personally I'd rename the field to Why_Why, not in the least since [] are
hard to get to on a norwegian keybord <g>
DoCmd.OpenReport "Communications Table", acPreview, WhereCondition:="[Why -
Why #] = " & Me.[Why - Why #].Value
Pieter
Very Basic User said:
Hello Pieter, I tried your code, but was not able to get it to work. This
is
my current code. It tries, but I get "Syntax errorin date in query
expression
'Why - Why # 14178'
DoCmd.OpenReport "Communications Table", acPreview
Reports![Communications Table].Filter = "Why - Why # = " & Me![Why - Why
#]
Reports![Communications Table].FilterOn = True
End Sub
--
Thank you for your time!
John
Pieter Wijnen said:
DoCmd.OpenReport ReportName, acViewDesign, WhereCondition := "MyIDField="
&
Me.MyIDField.Value
Or
DoCmd.OpenReport ReportName, acViewDesign, WhereCondition :=
"MyIDField='" &
Me.MyIDField.Value & "'"
First version for numeric 'MyIDField', seccond for Text
Place the code in The Click_Event [Event Procedure]
Of a CommandButton
HTH
Pieter
message
I would like to be able to click on a button in a form that generates a
report from that specific record I am looking at on the form. I have
the
form
and report completed. I just don't know how to tell the report that I
want
it
for the current record only.