Reputation: 101
Im a little stuck and I dont know what im doing wrong. I want to insert the current date into a MS Access database in VB. The part of the code im having trouble with is:
SQLString = "INSERT INTO Sales(DateSold) VALUES ("
SQLString += Date.Today & ")"
The type in the database is date and is dd/mm/year. Thanks in advance for the help.
Upvotes: 2
Views: 7933
Reputation: 328
If you didn't what to use the SQL NOW() you could wrap the date in quotes:
SQLString = "INSERT INTO (Sales) VALUES ("
SQLString += "'" & Date.Today & "')"
Upvotes: 2
Reputation: 1312
why don't you let access handle the date:
"INSERT INTO Sales VALUES (NOW())"
Upvotes: 0