B
Brian
Hello. I am wondering if it's possible to write code so
that when you click an import button on a form, a file
browser window pops up and lets you find the file you
wish to import, such as an excel spreadsheet. Then,
after you select the file, it would save the path to your
file in a string, FileLocation, allowing you to use it in
some code, such as:
Sub ImportSpreadsheet(FileLocation As String)
DoCmd.TransferSpreadsheet _
TransferType:=acImport, _
SpreadsheetType:=acSpreadsheetTypeExcel9, _
TableName:="tblImport", _
FileName:=FileLocation, _
HasFieldNames:=True
End Sub
This way I would not have to hard code a location for
FileName property. Thanks for any help!
Brian
that when you click an import button on a form, a file
browser window pops up and lets you find the file you
wish to import, such as an excel spreadsheet. Then,
after you select the file, it would save the path to your
file in a string, FileLocation, allowing you to use it in
some code, such as:
Sub ImportSpreadsheet(FileLocation As String)
DoCmd.TransferSpreadsheet _
TransferType:=acImport, _
SpreadsheetType:=acSpreadsheetTypeExcel9, _
TableName:="tblImport", _
FileName:=FileLocation, _
HasFieldNames:=True
End Sub
This way I would not have to hard code a location for
FileName property. Thanks for any help!
Brian