You must place a CommonDialog control on your form (XCommonDialog) and then you can use the following code on click event of a button called PosImg.

 

 

Private Sub PosImg_Click()

On Error GoTo Err_Browse

Dim strFilename As String

Dim oDialog As Object

Set oDialog = Me.XCommonDialog.Object

 

oDialog.CancelError = True

 

strDialogo = "description of window"

With oDialog   ' Ask for new file location.

  .DialogTitle = strDialogo

  .Filter = "File Excel (*.xls)|*.xls"         ‘file you’re searching for

  .FilterIndex = 1

  .ShowOpen

  ' If user responded, put selection into text box on form.

  If Len(.FileName) > 0 Then                 ‘here you can store in a field the file name and path name

    Me.El_XLname = Dir(.FileName)       

    Me.El_XLpath = .FileName                

  End If

 

End With

 

 

Exit_Browse:

    Exit Sub

Err_Browse:

    If Err.Number = cdlCancel Then Exit Sub

    MsgBox Err.Description

    Resume Exit_Browse

End Sub

 

-----Messaggio originale-----
Da: [email protected] [mailto:[EMAIL PROTECTED] Per conto di lostfayth
Inviato: lunedì 9 gennaio 2006 19.09
A: [email protected]
Oggetto: [AccessDevelopers] Add a file (hyperlink) from a form

 

Ok.  I have a Project Tracking Database.  I have a subform called Files

with a text box called FileLocation. 

 

I want to create a button or an onclick (doesn't matter) so that it

automatically opens a window so the user can search for the file on

thier hard drive.

 

Then when the user selects the file it automatically insert the file

location into the text box.

 

Any suggestions?

 

 

 

 

 

 

Please zip all files prior to uploading to Files section.

Yahoo! Groups Links

 

<*> To visit your group on the web, go to:

    http://groups.yahoo.com/group/AccessDevelopers/

 

<*> To unsubscribe from this group, send an email to:

    [EMAIL PROTECTED]

 

<*> Your use of Yahoo! Groups is subject to:

    http://docs.yahoo.com/info/terms/

 

 




Please zip all files prior to uploading to Files section.




YAHOO! GROUPS LINKS




Reply via email to