|
-
Mar 16th, 2000, 12:09 AM
#1
Thread Starter
Junior Member
I have an access table and I want to insert today's date into one of the field. What is the correct syntax.
This is not working:
Dim todaysdate as String
todaysdate = format(Now,"m/d/yy")
Insert into table(Date)Values(todaysdate)
Thanks
-
Mar 16th, 2000, 12:41 AM
#2
What seaweed has said is right, the only thing is, it is to be used in Client/Server database, not Access.
GetDate function is a Transact SQL function, but in Access you CAN use Date(), Time(), Now() functions. Just bear in mind that you can not use the function by itself, i.e:
Code:
Select Date() As MyDate From MyTable
You have to use it in combination with a real fields, i.e:
Code:
Select FieldName, Date() As MyDate From MyTable
-
Mar 16th, 2000, 01:49 AM
#3
Frenzied Member
Oops
Well, I deleted my first reply because I re-read the question and saw that he was talking about Access, not SQL server. It's been a while since I've done access, but I'm looking into it now...
~seaweed
-
Mar 16th, 2000, 02:10 AM
#4
New Member
Dates in Access
Hi..
I've inserted a date once using SQL and VB, And you have to do something freaky..
Make sure the SQL looks something like this:
SQL = "insert into Table Values( # "& date & " #)"
I cant seem to find the actual syntax (you may want to double check the double quotes and see if any single quotes are needed), but I know that you need the # before a date field for it to be properly accepted into access
hope that helps!
~Sam
-
Mar 16th, 2000, 04:08 AM
#5
Lively Member
Sam's got the right idea; his Syntax is correct as well.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|