Your technology certification is waiting. Enroll in Cloud Class ®
'This is sample code for if you want to insert FROM Excel instead of in Access
Private Sub CommandButton1_Click()
Dim db As Database, rs As Recordset, r As Long
Set db = OpenDatabase("DriveLetter:\DirectoryName\DirectoryName\DatabaseName.mdb")
'open the database
Set rs = db.OpenRecordset("TABLENAME", dbOpenTable)
.AddNew ' create a new record
'add values to each field in the record
.Fields("TableFieldName1") = Range("B" & 4).Value
.Fields("TableFieldName2") = Range("B" & 5).Value
.Fields("TableFieldName3") = Range("B" & 6).Value
.Fields("TableFieldName4") = Range("B" & 7).Value
.Fields("TableFieldName5") = Range("B" & 8).Value
.Fields("TableFieldName6") = Range("B" & 9).Value
.Fields("TableFieldName7") = Range("B" & 10).Value
.Update ' stores the new record
Set rs = Nothing
Set db = Nothing
Open in new window
Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.
Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.
Have a better answer? Share it in a comment.
Please enter a first name
Please enter a last name
Must be at least 4 characters long.
Join and Comment
From novice to tech pro — start learning today.
Premium members can enroll in this course at no extra cost.