MartinShort
New member
- Local time
- Today, 00:05
- Joined
- Aug 30, 2012
- Messages
- 3
Hi
I'm trying to import a row into an Access table; using a fairly simple VBScript.
The code below works perfectly UNTIL I add the final field - which is a date field (there's also a time field, which I haven't added yet).
Anyone able to help me with my syntax? It's driving me nuts and shouldn't be this complicated.
Thanks
Martin
ps - I realise this is VBS not VBA, but it's pretty well the same thing, so it seemed to make sense to bend the rules slightly on where to post this.
I'm trying to import a row into an Access table; using a fairly simple VBScript.
The code below works perfectly UNTIL I add the final field - which is a date field (there's also a time field, which I haven't added yet).
Code:
Const adOpenStatic = 3
Const adLockOptimistic = 3
Const adUseClient = 3
Set cn = CreateObject("ADODB.Connection")
Set rs = CreateObject("ADODB.Recordset")
cn.open "Provider=Microsoft.ACE.OLEDB.12.0; Data source=C:\test.accdb"
rs.CursorLocation = adUseClient
rs.open "INSERT INTO tblTimings (Tester,LoadTimeOld,SaveTimeOLD,LoadTimeNew, SaveTimeNEW,LocalHost,UserName,Date) " & _
"VALUES ('QTP',1,2,3,4,'PC0685','mshort',#2012/04/12#);", _
cn, adOpenStatic, adLockOptimistic
cn.Close
Set rs = Nothing
Set cn = Nothing
Anyone able to help me with my syntax? It's driving me nuts and shouldn't be this complicated.
Thanks
Martin
ps - I realise this is VBS not VBA, but it's pretty well the same thing, so it seemed to make sense to bend the rules slightly on where to post this.