Syntax error in VBA Code

Zaides

New member
Local time
Today, 00:02
Joined
Mar 2, 2019
Messages
4
HELP :banghead:

I have this multi layered Cmd on click for filtering a Qry that keeps giving me a Compile errora: Syntax error message. Can some seasoned experts please read through and tell me where the mistake is?

Private Sub AvancedSearchMailedBycmd_Click()
OpenQry.[PostMailingFilterQry, " ", acReadOnly]
ApplyFilter.[PostMailingFilterQry] WHERE(((PostMailingFilterQry.PostName) = "[Forms]![DashboardFrm]![PostNameAdvSrchByPostcbo]") And ((PostMailingFilterQry.DateMailedFromPost) >= [Forms]![DashboardFrm]![FromAdvSrchByPosttxt] And (PostMailingFilterQry.DateMailedFromPost) <= [Forms]![DashboardFrm]![ToAdvSrchByPosttxt])) And ((PostMailingFilterQry.TypeOfWorkReceived) = "[Forms]![DashboardFrm]![WorkTypeAdvSrchByPostcbo]")))

End Sub

Any all help is greatly appreciated!
 
Need DoCmd. in front of those commands. And OpenQry should be OpenQuery.

DoCmd.OpenQuery
DoCmd.ApplyFilter
 

Users who are viewing this thread

Back
Top Bottom