T
Tony H. via AccessMonster.com
I have a menu item to import data from an Excel file. I want the user to
browse for the file and import the file into Access which appends to the
tblMaster.
First, I copied the code by Ken Getz -
http://www.mvps.org/access/api/api0001.htm into a module named “BrowseFile”.
Then in another module named “import” I have the code below. In the menu
Item properties I have “=ImportEx()” in the on Action property. But when I
click on the menu I get an error “Ambiguous name ahtAddFilterItem”
Can anyone tell me what I’m doing wrong? Here’s my code…….
Public Function ImportEx()
Dim strFilter As String
Dim lngFlags As Long
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
Debug.Print Hex(lngFlags)
strInputFileName = ahtCommonFileOpenSave(InitialDir:=C:\", _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "tblMaster", ,
strInputFileName, True, ""
End Function
Thanks,
Tony
browse for the file and import the file into Access which appends to the
tblMaster.
First, I copied the code by Ken Getz -
http://www.mvps.org/access/api/api0001.htm into a module named “BrowseFile”.
Then in another module named “import” I have the code below. In the menu
Item properties I have “=ImportEx()” in the on Action property. But when I
click on the menu I get an error “Ambiguous name ahtAddFilterItem”
Can anyone tell me what I’m doing wrong? Here’s my code…….
Public Function ImportEx()
Dim strFilter As String
Dim lngFlags As Long
Dim strInputFileName As String
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
Debug.Print Hex(lngFlags)
strInputFileName = ahtCommonFileOpenSave(InitialDir:=C:\", _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
DoCmd.TransferSpreadsheet acImport, acSpreadsheetTypeExcel8, "tblMaster", ,
strInputFileName, True, ""
End Function
Thanks,
Tony