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!

How do I populate a record with a file name ? 1

Status
Not open for further replies.

DugyWugy

Technical User
Oct 13, 2000
25
CA

Hello List,

I have developed an Access application for viewing image files. I created a form to input the desired characteristics of the file. At this point users have to manually key in the path and file name. Is there a way that they could click a button and navigate to the file? Once they reach the desired directory - select the file and have the path and file name populate a record in the database.

Your help would be appreciated.
Regards,
Doug
 
In your Table add a New Text Field, on your Form add a New Text Box, call it say txtPicturePath, set its Control Source to the New Field in your Table.

Follow the instructions at thread705-457897. For your scenario, if you do have the Common Dialog Control, paste this into the on click event of a button on your form:

On Error GoTo ErrCommonDialog
gInitDir = "C:"
Set gCommonDialog = Me!CommonDialog1
OpenCommonDialog
Me!txtPicturePath = gFileName 'rename to your control name
'MsgBox gFileName
ErrCommonDialog:


If you don't have the Common Dialog Control, paste this into the on click event of a button on your form:

On Error GoTo ErrCommonDialog
Dim strFile As String
strFile = Find_File(glInitDir)
Me!txtPicturePath = strFile 'rename to your control name
'MsgBox strFile
ErrCommonDialog:
 
Bill

Thank-you for your help - this is working exactly the way I wanted.

Thanks again,
Doug
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top