|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello all,
I'm completely baffled as to why a certain SQL statement will not work, and thought maybe you might be able to lend a hand. I have a table called FMOutOfOffice, with (currently) 4 records in it. The Table fields are: - ID (pk) - Name (str) - Date (date) - Reason (str) - Delegate (str) My 4 records are currently this: 1 Name1 09/09/2004 Holiday2 Name10 2 Name2 10/09/2004 Holiday3 Name12 3 Name3 08/09/2004 Holiday1 Name13 4 Name4 09/09/2004 Holiday4 Name14 Where the dates in each record are the following respectively: 09/09/2004 10/09/2004 08/09/2004 09/09/2004 This statement works correctly, and returns all 4 records: strSQL = "SELECT * FROM FMOutOfOffice" This statement also works correctly, and returns 2 records: strSQL = "SELECT * FROM FMOutOfOffice WHERE date=#09/09/2004#;" However, this next sql statement returns no records, even though the date DOES exist: strSQL = "SELECT * FROM FMOutOfOffice WHERE date=#08/09/2004#;" This one also does not work strSQL = "SELECT * FROM FMOutOfOffice WHERE date=#10/09/2004#;" Am I missing something incredibly simple here? Many thanks in advance for any help you may offer Kind regards, - James |
|
#2
|
||||
|
||||
|
What database are you using?
|
|
#3
|
|||
|
|||
|
Quote:
It's (currently) an Access DB on the intranet, but I've never had this problem before with previous test Access DBs. Is there anything that you can see? |
|
#4
|
|||
|
|||
|
Solved
Quote:
Solved it. It's to do with International Date settings, as I'm from the UK, I still have to use US date format of mm/dd/yy. *OR* I use the DateValue() command which is what I've done. New SQL query : strSQL = "SELECT * FROM FMOutOfOffice WHERE date=DateValue('10/09/2004');" Thanks anyway for your time, - James |
![]() |
| Viewing: ASP Free Forums > Database > SQL Development > SQL Statement "broken" ? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|