DHompster
asked on
Use DCOUNT, etc. with dynamic SQL statement in VBA
In a VBA module, I need to get a count of records from a particular recordset, not a table. Is there some way I can embed the SQL statement in the DCount instead of using a table name?
Something like the Code sample below?
Something like the Code sample below?
If DCount("Zip", "SELECT tbl_PostalCodes_US.Zip FROM tbl_PostalCodes_US WHERE (((tbl_PostalCodes_US.Zip)=Left('" & Me.[Zip] & "',5)));") > 1 Then
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
No you can not use a select statement, it has to be a table or a saved query as the domain.
ASKER