473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

Access SQL date Format

Expand|Select|Wrap|Line Numbers
  1. Sub test()
  2.  
  3. Dim dbsCurrent As Database
  4. Dim qdfBestSellers As QueryDef
  5. Dim qdfBonusEarners As QueryDef
  6. Dim rstTopSeller As Recordset
  7. Dim rstBonusRecipients As Recordset
  8. Dim strAuthorList
  9.  
  10. Set dbsCurrent = CurrentDb
  11. Set frequencetbl = CurrentDb.OpenRecordset("Date", dbOpenDynaset)
  12.  
  13.  
  14. Set qdfBestSellers = dbsCurrent.CreateQueryDef("")
  15. With qdfBestSellers
  16.  
  17. .Connect = "ODBC;DATABASE=W;DSN=OSS"
  18.  
  19. .SQL = "SELECT STARTTIME FROM TABLE1 " & _
  20. "Where DateValue(STARTTIME)=#1/17/2007#"
  21.  
  22. Set rstTopSeller = .OpenRecordset()
  23.  
  24. rstTopSeller.MoveFirst
  25. End With
  26.  
  27.  
  28. With rstTopSeller
  29. Do While Not .EOF
  30.  
  31. frequencetbl.AddNew
  32. frequencetbl.Update
  33. .MoveNext
  34. Loop
  35. End With
  36.  
  37.  
  38. rstTopSeller.Close
  39. dbsCurrent.Close
  40.  
  41. End Sub

I am getting ODBC - Call Fail error. I guess the problem is with the "Where DateValue(STARTTIME)=#1/17/2007#". Any idea how to repair this?
Jan 18 '07 #1
2 4500
nico5038
3,080 Expert 2GB
Hmm, did you check or the query works on a linked table ?

I also see a table named "Date", but that's also a reserved word.....

Nic;o)
Jan 18 '07 #2
NeoPa
32,556 Expert Mod 16PB
  1. If STARTTIME is a Date/Time field then DateValue would be unnecessary and incorrect.
  2. I'm not sure about "Date" as a recordset name (as Nico says)
Try :
Expand|Select|Wrap|Line Numbers
  1. .SQL = "SELECT STARTTIME FROM TABLE1 " & _
  2.      "Where STARTTIME=#1/17/2007#"
Jan 19 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

13
by: Peter James | last post by:
Access 97 If I select New on the Query tab of the db window, and go staight to sql view and type in the following for example: INSERT INTO tblMyTable ( dtDate, txtAny) VALUES (#2003-09-03#,...
4
by: JMCN | last post by:
object invalid or no longer set - confusion of the recordset in access 2003. i am currently converting from access 97 to access 2003. majority of the codes converted over perfectly fine, though...
5
by: m_t_hill | last post by:
Running MS Access 2000 MS Windows XP Pro This has caused me a lot of hair loss in the last few days so would appreciate any help. I am running code to append/update a local access database...
9
by: Neil | last post by:
I have been coding with ASP for some time now. I am using an ACCESS database. I am in the UK and wish to use DD/MM/YYYY format for dates. I have had no end of problems and possible solutions to...
0
by: spm_no | last post by:
Hi, I am using Access 2002 and am creating a scatter-chart on a form in which the X-axis is a date. I can format and display the x-axis properly as a date. However, when I close and reopen...
5
by: Henning M | last post by:
Hi all, I having some problems with Access and selecting records between dates.. When I try this in access, it works fine!! "Select * from Bilag Where Mdates Between #1/1/2006# And...
5
by: Easystart | last post by:
Hi, Sorry for my English. English is not my native tougue. I am working in MS Access 2000 with a SQLServer 2000 Backend database. MS Access 2000 is my GUI front end that has SQLServer linked...
2
by: hardik | last post by:
hi friends, i am really surprized the way access behaves in date fields i mean it's all ok when you have us time zone or us servers but if you have diffrent timezone like uk then access creates...
9
by: pic078 via AccessMonster.com | last post by:
I need serious help - I have a frontend/backend Access database (2 MDE Files) that remains stuck in task manager after exiting the application - you can't reopen database after exiting as a result...
8
by: saladinator | last post by:
I have created an Excel spreadsheet that has a lot of data. What I want to do is import the spreedsheet to Access and create a form so that I can print each row per page in a proffessional manner....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.