That is the problem with AIR CODE. I can't really compile and test it. I've changed it since the original post. Are you replacing *all* of the previous code with my latest post? Try it again. Leave the stuff in the standard module alone.
That is the problem with AIR CODE. I can't really compile and test it. I've changed it since the original post. Are you replacing *all* of the previous code with my latest post? Try it again. Leave the stuff in the standard module alone.
I hear you on the "air code." I try diagnosing people's problems restoring classic Thunderbirds without ever seeing the car. But that's easier, I'm sure.
Definitely getting there... It fires right, but now the error is:
"The Microsoft Office Access database engine could not find the object "c:\documents and settings\Stephen\Desktop\Excel Files (*.xls)".
I cribbed something together on my system and it looks like it should work. How about pasting what you have here. Use the code tags (press the # button).
I'm inserting it exactly as below. I don't understand the "code tags" piece you requested. Sorry, learning....
Private Sub ImportButton_Click()
Dim strFilter As String
strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS")
SelectFile = ahtCommonFileOpenSave( _
Filter:=strFilter, OpenFile:=True, _
DialogTitle:="Please select an input file...", _
Flags:=ahtOFN_HIDEREADONLY)
DoCmd.TransferSpreadsheet _
acImport, _
acSpreadsheetTypeExcel5, _
"SvcCallImportTbl", _
strFilter, _
True
End Sub
That's what I thought. Copy what I have here and paste it over what you have.
If you use the advanced mode or press the Post Reply button, one of the tool buttons is the Octothorpe "#". If you press it, it will put two code tags in your window. Anything inside of the tags has the indentation preserved as my code does. Without the tags, the system removes most of the white space and you loose your formatting.Code:Private Sub ImportButton_Click() Dim strFilter As String Dim SelectFile As String strFilter = ahtAddFilterItem(strFilter, "Excel Files (*.XLS)", "*.XLS") SelectFile = ahtCommonFileOpenSave( _ Filter:=strFilter, OpenFile:=True, _ DialogTitle:="Please select an input file...", _ Flags:=ahtOFN_HIDEREADONLY) DoCmd.TransferSpreadsheet _ acImport, _ acSpreadsheetTypeExcel5, _ "SvcCallImportTbl", _ SelectFile, _ True End Sub
YIPPEEEEE!!!!!!!!
Good to know. So QuickReply 86's a bunch of formatting information. Were I more experienced, I would have noticed. Sorry about that.
It took me a minute to reply because I've been jumping up and down on my desk once it worked!
Final question, and ABSOLUTELY feel free to say "I'm busy with my day job now, pound sand," if it's a difficult thing to do. The reverse is also very useful. Taking the table and exporting to a spreadsheet. Say, SITEDATA table exported to (excel file chosen). Easy, or hard?
Thanks a million. This really cleaned things up in this application. I sincerely appreciate your help.
Stephen.
Just as easy.
Why don't they make a function like that for IMPORTING?!?!?!
DoCmd.OutputTo acOutputTable, "Tbl_YourTable", acFormatXLS
Because you need to create the Import Specification first and save it.