Link to home
Start Free TrialLog in
Avatar of Mcblake
Mcblake

asked on

Change Recordsource using SQL

I would like to change my recordsource using SQL and filter my recordsouce using Date.. So, I try to create source code like this

data1.recordsource = "select * from mytable where proddate = " & maskedbox1.text

It show nothing , So, I try

data1.recordsource = " select * from mytable where proddate = " & "'" & maskedbox1.text & "'"
It show an error data type mismatch..

So, I try for declare variable as date

dim sdate as date

sdate = proddate

data1.recordsource = "select * from mytable where proddate = " & sdate

It still show nothing, even I try

data1.recordsource = "select * from mytable where proddate = " & "5/5/98"

It still show nothing.. How could I solve this problem?

PS. I use MS-Access 95 as my database and proddate is a field use Date as data type , format shortdate..

Thank you in advance.
ASKER CERTIFIED SOLUTION
Avatar of dirtdart
dirtdart

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial