Insert date and time field into MS Access with SQL 
Author Message
 Insert date and time field into MS Access with SQL

INSERT INTO t_import (netid, What, Where, Date, Time, Computer, Paper_size,
File_size, #pages, Charge, Balance)

VALUES ('" & A(0) & "','" & A(1) & "','" & A(2) & "',#" & dateVal & "#,#" &
timeVal & "#,'" & A(5) & "','" & A(8) & "','" & A(10) & "','" & A(11) & "',"
& A(12) & "," & A(13) & ")"

Basically, I have to handle the dateVal and the timeVal variables to
correctly insert them into an MS Access Short Date and Short Time,
respectively.

How do I do this?

Thanks,
Scott



Wed, 22 Sep 2004 08:58:53 GMT  
 Insert date and time field into MS Access with SQL
You could make a command object that calls a parameterized "append
query".  It will be a few more lines of code, but ->)| WAY |(<- easier
to work with than monstrosities like this.

another thing you could do is make a delimiting function that accepts
a Variant as a parameter and returns a string containing the "value"
with appropriate delimiters.

--
Peace & happy computing,

Mike Labosh, MCSD MCT
"Feed the children!  Save the whales!  Free the mallocs!" --Unknown



Wed, 22 Sep 2004 10:22:50 GMT  
 Insert date and time field into MS Access with SQL
I agree. As long as you set the parameters to the right datatype you
just assign the values from your variables and ADO sorts it out. You
don't have to format anything.
Quote:

> You could make a command object that calls a parameterized "append
> query".  It will be a few more lines of code, but ->)| WAY |(<- easier
> to work with than monstrosities like this.

> another thing you could do is make a delimiting function that accepts
> a Variant as a parameter and returns a string containing the "value"
> with appropriate delimiters.



Fri, 24 Sep 2004 15:44:15 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. ADO with Access Date/Time field not storing the time, just the date

2. CRW with MS Access 2.0 date/time fields

3. MS Access Date/Time Field in Crystal

4. MS Access Date/Time field - American/English

5. Problem accessing record from SQL Data base Date/Time Field

6. Problem Using Time Part of a Date-Time field in SQL-Server

7. How do I store an empty date on a date field (MS Access)

8. Null date values in Date/Time fields in Access DB

9. bound masked field to date/time field in access not formatting right

10. Matching system date/time with field date/time

11. Inserting a date field into SQL

12. HELP with DATE/TIME field from MS-Access97

 

 
Powered by phpBB® Forum Software