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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Insert into Issue with the Date in Access 1

Status
Not open for further replies.

Bollard

IS-IT--Management
Feb 1, 2007
6
0
0
US
Hello,

I am trying to pass a date into a Access Table through VBA
and all of the information goes in right except for the date, it always comes up as 12/30/1899 in the table. I did a message box to display the format that it is leaving the form in and it is correct 6/7/2007 here is the code:

Dim sq5, options, values, proID, dt, hrs As String

options = "([ProjectID], [dt1], [hrs1])"
values = "(" & proID & "," & dt & "," & hrs & ");"

If txtDateRcvd = txtDueDate Then

Set db2 = CurrentDb
sq5 = "INSERT INTO tbl" & whichCompany & "BreakDown" & options & "VALUES" & values
MsgBox sq5
DoCmd.SetWarnings False
DoCmd.RunSQL (sq5)
DoCmd.SetWarnings True
pid = -1
Call txtstaff_Change
Set db2 = Nothing

I am pretty sure this is a simple problem, but I am going nuts trying to figure it out any help would be greatly appericated. Thanks.
 
values = "(" & proID & ",[!]#[/!]" & dt & "[!]#[/!]," & hrs & ");"

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
It worked!! Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top