D
Dave
Hi,
I'm using Excel to access an Access DB. I have set up my fields as
Date/Time and my command string looks like this:
sSQL = "INSERT INTO barcode_dtls "
sSQL = sSQL & "(bcd_barcode,bcd_ref_no,bcd_date_created,"
sSQL = sSQL & "bcd_date_cleared,bcd_created_by) "
sSQL = sSQL & "VALUES ("
sSQL = sSQL & p_barcode & ","
sSQL = sSQL & p_ref_no & ","
sSQL = sSQL & Date & ","
sSQL = sSQL & Date & ","
'sSQL = sSQL & Application.UserName & ");"
sSQL = sSQL & "'xxxx'" & ");"
oCmd.CommandText = sSQL
oCmd.Execute
Apologies for making this long winded by including all the source code
but, when I look at my rows in Access they always have 30/12/1899 in
them. I'm now very confused. This should be straight forward but it's
now hair-pulling time - what little I have left!
Also, I wanted to store Application.Username in a Access Text field -
but it refuses to run the line which is commented out (above). I can
only get it to insert the 'xxxx' bit - any ideas? Do I need to run
some functions on these first?
Any help would be great,
Thanks.
Dave
I'm using Excel to access an Access DB. I have set up my fields as
Date/Time and my command string looks like this:
sSQL = "INSERT INTO barcode_dtls "
sSQL = sSQL & "(bcd_barcode,bcd_ref_no,bcd_date_created,"
sSQL = sSQL & "bcd_date_cleared,bcd_created_by) "
sSQL = sSQL & "VALUES ("
sSQL = sSQL & p_barcode & ","
sSQL = sSQL & p_ref_no & ","
sSQL = sSQL & Date & ","
sSQL = sSQL & Date & ","
'sSQL = sSQL & Application.UserName & ");"
sSQL = sSQL & "'xxxx'" & ");"
oCmd.CommandText = sSQL
oCmd.Execute
Apologies for making this long winded by including all the source code
but, when I look at my rows in Access they always have 30/12/1899 in
them. I'm now very confused. This should be straight forward but it's
now hair-pulling time - what little I have left!
Also, I wanted to store Application.Username in a Access Text field -
but it refuses to run the line which is commented out (above). I can
only get it to insert the 'xxxx' bit - any ideas? Do I need to run
some functions on these first?
Any help would be great,
Thanks.
Dave