Using A Query In Vba

Milan

Registered User.
Local time
Today, 20:57
Joined
Feb 17, 2002
Messages
85
Hi People!

I have an Access Query which I have go into design view/ SQl View : SELECT TblComplianceLine.ComplianceNo, TblComplianceLine.Description, TblComplianceLine.Comments, TblComplianceLine.AuditDate, TblComplianceLine.PointsLost
FROM TblComplianceLine
WHERE (((TblComplianceLine.AuditDate)=selectdate()) AND ((TblComplianceLine.Process)="SD"));

I need to use this in VB!! i have tried pasting it into a sub routine but it does not work. How can I get this to work in a sub procedure rather then a query?.

Many Thanks

Milan
 
Are you running this from a Command button?
 
Like this

"SELECT TblComplianceLine.ComplianceNo, TblComplianceLine.Description, TblComplianceLine.Comments, TblComplianceLine.AuditDate, TblComplianceLine.PointsLost
FROM TblComplianceLine
WHERE (((TblComplianceLine.AuditDate)="
& "#" &
selectdate()
& "#" &
") AND ((TblComplianceLine.Process)='SD'))"


RichM
 

Users who are viewing this thread

Back
Top Bottom