Maybe one of you Access/VB gurus can help me out here. I have an Access Database with some info stored by date. I'm trying to query it from VB, but I keep getting empty datasets even though I know they are there. In Access I have the Data field formatted to a short date. In VB I have a combo box with a selection of dates also in short format (at least that is how they are displayed) and an SQL statement like this:

dim dat as Date
dim SQL as string
dim SHW as Dataset
dim db as Database

dat = cdate(combo1.text)
Set db = OpenDatabase(dbfile)

SQL = "SELECT ALL * FROM mydata WHERE (mydata.[Date] = " & dat & ");"
Set SHW = db.OpenRecordset(SQL, dbOpenDynaset)

It keeps returning 0 in the record count. Is there a specific format I need to use either in the database itself or in running the query?

Cameron


--------------------------------------------------------------------- List hosting provided by Directions Magazine | www.directionsmag.com | To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Message number: 9591



Reply via email to