|
-
Sep 4th, 2001, 05:46 AM
#1
Thread Starter
Lively Member
Common Control Dialog
Ive given a button the action:
Private Sub Command49_Click()
ActiveXCtl48.ShowOpen
MsgBox "Filename: " & _
ActiveXCtl48.FileTitle
MsgBox "Path: " & Left$(ActiveXCtl48.FileName, _
Len(ActiveXCtl48.FileName) - Len(ActiveXCtl48.FileTitle))
MsgBox "Filename: " & _
ActiveXCtl48.FileName
End Sub
which works perfectly fine (the msgbox's are just for verification)
I have a text box called "txtDocPath". When the user chooses the file after clicking the button, I want this text box to be updated with the path and filename (with extension) of the chosen file.
Any help will be greatly appreciated.
Regards
Paul
BTW this is in msaccess 97.
-------------------------------------
ICQ: 44712087 (evenings only)
Email: [email protected]
-
Sep 4th, 2001, 06:25 AM
#2
-= B u g S l a y e r =-
VB Code:
Private Sub Command49_Click()
ActiveXCtl48.ShowOpen
MsgBox "Filename: " & _
ActiveXCtl48.FileTitle
MsgBox "Path: " & Left$(ActiveXCtl48.FileName, _
Len(ActiveXCtl48.FileName) - Len(ActiveXCtl48.FileTitle))
MsgBox "Filename: " & _
ActiveXCtl48.FileName
txtDocPath.Text = ActiveXCtl48.FileName
End Sub
Last edited by peet; Sep 4th, 2001 at 06:29 AM.
-
Sep 4th, 2001, 06:35 AM
#3
Thread Starter
Lively Member
Thanks, but i get a run time error:
Run Time error '2185'
You can't reference a property or method for a contol unless the control has the focus
Regards
paul
-------------------------------------
ICQ: 44712087 (evenings only)
Email: [email protected]
-
Sep 4th, 2001, 06:39 AM
#4
Thread Starter
Lively Member
oh dont worry, sorted it...
needed to add
Forms!frmImportApp3!txtDocPath.SetFocus
thanks a lot for your help
Paul
-------------------------------------
ICQ: 44712087 (evenings only)
Email: [email protected]
-
Sep 4th, 2001, 06:42 AM
#5
Thread Starter
Lively Member
you can help me further on it tho plz....
I need to set the default path for the open box, and also make only .xls files visible (think its called a filter)
thanks a lot
-------------------------------------
ICQ: 44712087 (evenings only)
Email: [email protected]
-
Sep 4th, 2001, 02:15 PM
#6
-= B u g S l a y e r =-
VB Code:
ActiveXCtl48.InitDir = "C:\"
ActiveXCtl48.Filter = "Excel (*.xls)|*.xls"
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|