Solved

INSERT INTO Date Values

Posted on 2007-11-14
1
1,183 Views
Last Modified: 2010-05-18
Hitting a wall.  I want to transfer date values from tblInquiry to tblReservations.  Using the code below, I get an incorrect date added to the tblReservations . . . like year 1899.

Dim mySQL As String
    mySQL = "INSERT INTO tblReservation (lngResID, lngGuestID, datArrivalDate, bytNoOfNights, datDepartureDate ) Values(" & Me.lngResID & ", " & Me.lngGuestID & ", " & Me.datArrivalDate & ", " & Me.bytNoOfNights & ", " & Me.datDepartureDate & ")"
    CurrentDb.Execute mySQL

I'm sure I have to do something to the date values, but not sure what.
0
Comment
Question by:copperdave
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
1 Comment
 
LVL 15

Accepted Solution

by:
jmantha709 earned 250 total points
ID: 20280970
You have to delimit dates using # :

Dim mySQL As String
    mySQL = "INSERT INTO tblReservation (lngResID, lngGuestID, datArrivalDate, bytNoOfNights, datDepartureDate ) Values(" & Me.lngResID & ", " & Me.lngGuestID & ", #" & Me.datArrivalDate & "#, " & Me.bytNoOfNights & ", #" & Me.datDepartureDate & "#)"
    CurrentDb.Execute mySQL
0

Featured Post

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
This article describes two methods for creating a combo box that can be used to add new items to the row source -- one for simple lookup tables, and one for a more complex row source where the new item needs data for several fields.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
With Microsoft Access, learn how to start a database in different ways and produce different start-up actions allowing you to use a single database to perform multiple tasks. Specify a start-up form through options: Specify an Autoexec macro: Us…

739 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question