Active X Control

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • CD Tom
    Contributor
    • Feb 2009
    • 495

    #1

    Active X Control

    Here's my problem. My application is running great on windows 7, when I try and move it to an XP machine the browse command doesn't work. I use the browse command to when I am trying to relink the database. I have a button on a form to browse for the database, when the database is found I then have another button to link the new location of the database. When I look at the form on my Windows 7 machine I see the active X Control the OLE class is commondialog the Class is MSComDlg.Common Dialog.1 when I look at the form on my XP machine this control isn't there. I don't know how to add that control, can anybody help.
    Thanks.
  • CD Tom
    Contributor
    • Feb 2009
    • 495

    #2
    I forgot to mention that I'm using Access 2007. Sorry about that.

    Comment

    • ADezii
      Recognized Expert Expert
      • Apr 2006
      • 8834

      #3
      1. Why use an ActiveX Control in the first place? The simpler, and safer Office File Dialog would serve the same purpose, wouldn't it?
      2. Why not incorporate the Browse and Link Operations into a single process, as opposed to two?

      Comment

      • CD Tom
        Contributor
        • Feb 2009
        • 495

        #4
        That sounds like a great idea. Is there a sample somewhere that I could copy or can you point me to where I could find how to do this.

        Comment

        • ADezii
          Recognized Expert Expert
          • Apr 2006
          • 8834

          #5
          'First, set a Reference to the Microsoft Office XX.X Object Library
          Code:
          Dim strButtonCaption As String
          Dim strDialogTitle As String
          'Dim strHyperlinkFile As String
          
          'Define your own Captions if necessary
          strButtonCaption = "Open"
          strDialogTitle = "Select Access Database to Link"
          
          With Application.FileDialog(msoFileDialogFilePicker)
            With .Filters
              .Clear
              .Add "Access Databases", "*.mdb,*.accdb"
            End With
            'The Show Method returns True if 1 or more files are selected
              .AllowMultiSelect = False                   'Critical Line
              .FilterIndex = 1                            'Database files
              .ButtonName = strButtonCaption
              .InitialFileName = vbNullString
              .InitialView = msoFileDialogViewDetails     'Detailed View
              .Title = strDialogTitle
            If .Show Then
              'The Absolute PATH to the Selected Database is contained in .SelectedItems(1)
              'You now have all you need to initiate the Link
               MsgBox "You have selected [" & .SelectedItems(1) & "] to Link"
            End If
          End With

          Comment

          • CD Tom
            Contributor
            • Feb 2009
            • 495

            #6
            Work perfect thanks again for all your help.

            Comment

            • ADezii
              Recognized Expert Expert
              • Apr 2006
              • 8834

              #7
              Originally posted by CD Tom
              Work perfect thanks again for all your help.
              You are quite welcome, CD Tom.

              Comment

              • CD Tom
                Contributor
                • Feb 2009
                • 495

                #8
                I just ran into a problem. When I try and select a mapped drive I get an error message The drive "M:" is not valid. Enter a valid drive letter. The only drive I can select is the C drive. What do I need to do so I can select any drive.
                Again thanks for your help.

                Comment

                • CD Tom
                  Contributor
                  • Feb 2009
                  • 495

                  #9
                  That was my problem the network computer that I was trying to connect to wasn't turned on. Sorry,

                  Comment

                  Working...