YamiMarik777
Registered User.
- Local time
- Today, 02:26
- Joined
- Jul 17, 2006
- Messages
- 12
Right now I have to go to each user and put in their path to import the spreadsheet into Access. I want to know if anyone knows how to let the user browse or use Windows Explorer to find the spreadsheet in the TransferSpreadsheet action?
Here is the code:
'------------------------------------------------------------
' ImportExcel
'
'------------------------------------------------------------
Function ImportExcel()
On Error GoTo ImportExcel_Err
' Delete records in OldInvoices if applicable
DoCmd.OpenQuery "qryDelRecs", acViewNormal, acEdit
' Close Delete query
DoCmd.Close acQuery, "qryDelRecs"
' Import data frm Excel to Access
DoCmd.TransferSpreadsheet acImport, 8, "tblOldInvoices", "C:/Documents and Settings\JKFinance\My Documents\Finance\MasterCard\PCard 1 .xls", True, "B1:Q510"
' Append record frm OldInvoices to tblInvoices
DoCmd.OpenQuery "qryAppendRecs", acViewNormal, acEdit
' Close Append Query
DoCmd.Close acQuery, "qryAppendRecs"
' Delete records in OldInvoices table
DoCmd.OpenQuery "qryDelRecs", acViewNormal, acEdit
' Close delete query
DoCmd.Close acQuery, "qryDelRecs"
' Return back to Switchboard
DoCmd.OpenForm "Switchboard", acNormal, "", "", , acNormal
ImportExcel_Exit:
Exit Function
ImportExcel_Err:
MsgBox Error$
Resume ImportExcel_Exit
End Function
Here is the code:
'------------------------------------------------------------
' ImportExcel
'
'------------------------------------------------------------
Function ImportExcel()
On Error GoTo ImportExcel_Err
' Delete records in OldInvoices if applicable
DoCmd.OpenQuery "qryDelRecs", acViewNormal, acEdit
' Close Delete query
DoCmd.Close acQuery, "qryDelRecs"
' Import data frm Excel to Access
DoCmd.TransferSpreadsheet acImport, 8, "tblOldInvoices", "C:/Documents and Settings\JKFinance\My Documents\Finance\MasterCard\PCard 1 .xls", True, "B1:Q510"
' Append record frm OldInvoices to tblInvoices
DoCmd.OpenQuery "qryAppendRecs", acViewNormal, acEdit
' Close Append Query
DoCmd.Close acQuery, "qryAppendRecs"
' Delete records in OldInvoices table
DoCmd.OpenQuery "qryDelRecs", acViewNormal, acEdit
' Close delete query
DoCmd.Close acQuery, "qryDelRecs"
' Return back to Switchboard
DoCmd.OpenForm "Switchboard", acNormal, "", "", , acNormal
ImportExcel_Exit:
Exit Function
ImportExcel_Err:
MsgBox Error$
Resume ImportExcel_Exit
End Function