You mentioned script, so I'll assume you mean script and will answer accordingly (no strongly-typed Dims, for example).
The 'chunk' of code you describe might look something like this:
Dim cnn
Set cnn = CreateObject("ADODB.Connec
cnn.Open = "Provider=Microsoft.Jet.OL
cnn.Execute "INSERT INTO SomeTable ( SomeField ) VALUES (#" & Now() & "#)"
cnn.Close
Set cnn = Nothing
Of course, you'd have to change the third line of code to reflect your Access database location and name and the fourth line of code to reflect the actual table and field names.
Hope this helps.
Main Topics
Browse All Topics





by: vinnyd79Posted on 2005-09-27 at 13:39:01ID: 14970453
Just to clarify, are you looking to do this from a vbscript (.vbs file)? If so,here is a basic example that can be added to your script:
tion") et.OLEDB.4 .0"
ordset")
set conn= CreateObject("ADODB.Connec
conn.Provider="Microsoft.J
conn.Open "c:\MyDatabase.mdb" ' change to name of your database
set rs=CreateObject("ADODB.rec
rs.CursorLocation=3 ' adUseClient
rs.CursorType=1 ' adOpenKeyset
rs.LockType=3 ' adLockOptimistic
rs.Open "Select * from MyTable", conn ' change MyTable to name of your Table
' add new record
rs.AddNew
rs.Fields("field1").Value = Now ' Change field1 to name of your field
rs.Update
' cleanup
rs.close
conn.Close
Set rs = Nothing
Set conn = Nothing