I am searching for a way to create multiple records in Access 2000 from
a worksheet created in Excel. I'm pretty much self-taught with Visual
Basic so forgive me if this poorly described. Basically what happens
is, from Access, while in Form1, I click a button that opens Excel and
my worksheet. This worksheet contains a button with the following code
( I've replaced the sections where I assign cell values to the
variables with ellipses):
Dim oAcc As Object
...
Set oAcc = GetObject(, "Access.Applica tion")
...
If oAcc.Forms!Form 1.NewRecord = True Then ' check to ensure I don't
write over old data
oAcc.Forms!Form 1![Amount] = curTotal
oAcc.Forms!Form 1![Description] = strValue
oAcc.Forms!Form 1![Notes] = strNotes
End if ' oAcc.Forms!Form 1.NewRecord = True
This works just fine for one record; I close out excel with the program
and return to Access with the form filled in. However, now I'm trying
to expand to calculate multiple rows of the same formulas and create a
new record in Access for each row. From Access I would just run
DoCmd.GoToRecor d , , acNewRec but I don't know how to reference
something like that from Excel. Any suggestions?
a worksheet created in Excel. I'm pretty much self-taught with Visual
Basic so forgive me if this poorly described. Basically what happens
is, from Access, while in Form1, I click a button that opens Excel and
my worksheet. This worksheet contains a button with the following code
( I've replaced the sections where I assign cell values to the
variables with ellipses):
Dim oAcc As Object
...
Set oAcc = GetObject(, "Access.Applica tion")
...
If oAcc.Forms!Form 1.NewRecord = True Then ' check to ensure I don't
write over old data
oAcc.Forms!Form 1![Amount] = curTotal
oAcc.Forms!Form 1![Description] = strValue
oAcc.Forms!Form 1![Notes] = strNotes
End if ' oAcc.Forms!Form 1.NewRecord = True
This works just fine for one record; I close out excel with the program
and return to Access with the form filled in. However, now I'm trying
to expand to calculate multiple rows of the same formulas and create a
new record in Access for each row. From Access I would just run
DoCmd.GoToRecor d , , acNewRec but I don't know how to reference
something like that from Excel. Any suggestions?
Comment