View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Lynn Arlington Lynn Arlington is offline
external usenet poster
 
Posts: 9
Default Excel data to Access?

I do the same thing but I start in Access, use a button to open the file in
Excel, make changes and save it, then back in Access import into the Access
database.

For another transfer, I have this process in an excel spreadsheet attached
to a button

I have a cell (2,3) to put the access filename

Sub cmdImport() ' attached to a button on an excel spreadsheet

Dim db As DAO.Database
Dim objRS As DAO.Recordset
Dim qryDef As DAO.QueryDef

If IsEmpty(Cells(2, 3)) Then
MsgBox "You must first select the location of the database.",
vbCritical
Cells(2, 3).Select
Exit Sub
End If

Set db = OpenDatabase(Cells(2, 3))

'put something here .....
' maybe db.excecute

' or use the db.DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel4,
"tblImport", txtImportFile, True

End sub

Does that give you an idea to start with?

Lynn


"Norm" wrote:

I have a macro to validate monthly data. After the data
is verified, it needs to go to an Access table. I'd like
to do that from Excel and then the user will go to Access
to do the rest of the processing.

Access has a 'TransferSpreadsheet' command, but what would
you suggest to use from an Excel macro to go to Access?
Surely there's something better to use than opening an ADO
recordset and then writing each record.

Thank You!