vba - Filtering Access Report based on Access Form field -
i have access form , access report. create macro when user clicks button, report automatically filtered specific record on form.
note: [store name] field not identical [store number] field. in past, have been manually going report , filtering report using text filters>contains> value.
example: [store name] might "#001 - los angeles", [store number] 001, filtering [store name] field text contains 001.
here's got far:
private sub command466_click() dim myvariable string myvariable = [storenumber] docmd.openreport "report query", acviewpreview, , [store name] myvariable end sub
i'm not great @ vba, i've been receiving error:
"microsoft access can't find field '|1' referred in expression".
the fourth argument of openreport
method must valid sql where
clause without word where
.
try this:
private sub command466_click() dim myvariable string myvariable = [storenumber] docmd.openreport "report query", acviewpreview, , "[store name] '*" & myvariable & "*'" end sub
Comments
Post a Comment