Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

dtpicker and sql

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
0
0
i have a problem with a sql sentence

"SELECT * FROM saldoa WHERE mo = 1 AND (fecha BETWEEN #" & DTPicker1.Value & "# AND #" & DTPicker2.Value & "#)"

"saldoa" is the name of the access database
"mo" is a field
"fecha" is the date field
then i want all the records whose in the field "mo" = 1 and between 2 given dates
the problem is that the sentence can´t find the records, could be the format of the date?
i have visual basic 6 sp5 in spanish and the date in this version is dd/mm/yyyy and i guess sql handle the date mm/dd/yyyy plus i have the long date format in the database,that include the hour.

thank you for your help

 
An SQL statement's From clause has to reference a table and not a database. If 'saldoa' is the name of the database then change that to the name of the table that has the fields 'mo' and 'fecha'.

Hope this helps. Thanks and Good Luck!

zemp
 
I may be wrong but numeric values that I know of aren't supposed to be surrounded by number signs. So if that's the case then the query should look like this:

"SELECT * FROM saldoa WHERE mo = 1 AND (fecha BETWEEN " & DTPicker1.Value & " AND " & DTPicker2.Value & ")"

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top