needing help with "strWhere" statement

K

Kelvin Beaton

I'm using a button to print a report, based on the "AISPID" on the current
record on form "frmAnnualISPReview_subform"
I seem to have my syntax wrong, again.
If ""[forms]![frmAnnualISPReview_subform]![AISPID]" points to the field on
the form that I want to print my report for.
What does "Me.AISPID" point to?

Is the syntax where the field on the report = the field on the report?

Where do the "" fit in if the fields are numeric?

strWhere = "[forms]![frmAnnualISPReview_subform]![AISPID] = " &
Me.AISPID
DoCmd.OpenReport "rptAnnualISPReview", acViewPreview, , strWhere

Thanks

Kelvin
 
R

Roger Carlson

Generally, you put the Field first, then the form control (although I doubt
if it makes much difference). Like this:

strWhere = "[AISPID] = " & [forms]![frmAnnualISPReview_subform]![AISPID]

[AISPID] being a field in the recordsource of your report. And
[forms]![frmAnnualISPReview_subform]![AISPID] being a textbox on your form.

--
--Roger Carlson
MS Access MVP
Access Database Samples: www.rogersaccesslibrary.com
Want answers to your Access questions in your Email?
Free subscription:
http://peach.ease.lsoft.com/scripts/wa.exe?SUBED1=ACCESS-L
 
Top