Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ' Code for Excel VB to post to a db, in this case an access file in the same working directory as the excel.
- ' Posts the values in the named cells "loadname, loadpallet, loaddue, etc into the mentioned db columns
- ' the ssql string variable doesn't have to be created and con-catted but makes it easier to manage/reuse
- Set cn = CreateObject("ADODB.Connection")
- dbPath = Application.ActiveWorkbook.Path & "\DLDB.mdb"
- scn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & dbPath
- dsh = "[" & Application.ActiveSheet.name & "$]"
- cn.Open scn
- ssql = "INSERT INTO DL ([Load], [Due], [Sent], [Driver], [15min Late], [Minutes Late]) "
- ssql = ssql & " VALUES ('" & loadname.Value & ",'" & loaddue.Value & " ','" & loadcheck.Value & "','" & loaddriver & "'," & reallylate & "," & minlate & ")"
- cn.Execute ssql
- cn.Close
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement