Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

I have created a database, have a c

Status
Not open for further replies.

Kathrynlewis

Technical User
Jun 6, 2002
25
US
I have created a database, have a command button but can't figure out VBA Code to select a file from the shared drive.
I would like to be able to click Command1 button
and be prompted to select file from specific folder on shared drive so that I can import it. Anyone know what the string is for this? This is what I have- but not working. What's wrong?

This works to import:
Private Sub Command1_Click()
DoCmd.TransferSpreadsheet (acImport), acSpreadsheetTypeExcel7, "AIRTEST", "L:\Marketing\Communications\Promos\Promos 2004\RegionOrders\AIRTEST.xls", -1
DoCmd.OpenTable ("AIRTEST"), acViewNormal, acEdit
End Sub

I tried to make it more specific with this, but doesn't work:
Private Sub Command1_Click()
Dim fn As String
fn = InputBox("Enter Path and File Name", "File Import")
End Sub
 
Look into

GetOpenFileName

that should do what you're looking for!

HTH

Leslie
 
That didn't seem to help or work....any other suggestions?
 
I searched these fora for 'GetOpenFileName' and found 55 threads that mention it. Here are a few, the first one has a lot of code already written that does what you are looking for:

Thread705-457897
Thread707-522045
Thread705-660357

Good luck


Leslie
 
great, think I have something working here! THanks for all your help.!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top