Results 1 to 6 of 6

Thread: Common Control Dialog

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Posts
    122

    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]

  2. #2
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. Private Sub Command49_Click()
    2. ActiveXCtl48.ShowOpen
    3.  
    4. MsgBox "Filename: " & _
    5. ActiveXCtl48.FileTitle
    6. MsgBox "Path: " & Left$(ActiveXCtl48.FileName, _
    7. Len(ActiveXCtl48.FileName) - Len(ActiveXCtl48.FileTitle))
    8.  
    9. MsgBox "Filename: " & _
    10. ActiveXCtl48.FileName
    11.  
    12. txtDocPath.Text = ActiveXCtl48.FileName
    13. End Sub
    Last edited by peet; Sep 4th, 2001 at 06:29 AM.
    -= a peet post =-

  3. #3

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Posts
    122
    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]

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Posts
    122
    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]

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Sep 2001
    Posts
    122
    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]

  6. #6
    -= B u g S l a y e r =- peet's Avatar
    Join Date
    Aug 2000
    Posts
    9,629
    VB Code:
    1. ActiveXCtl48.InitDir = "C:\"
    2. ActiveXCtl48.Filter = "Excel (*.xls)|*.xls"
    -= a peet post =-

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width