Object in this control

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

    #1

    Object in this control

    I've switch my database from 2003 to 2007 and find a problem with a relink module that I've been using. The code I've been using is RelinkCode and what it does is if the database can not be found it allows you to locate the current database and then relink it. Everything worked great when using 2003 but now with 2007 I get "There is no Object in this control" the code that it stops on is
    Code:
    Public Function Browse()
        ' Prompts user for Cowboy Action database file name
        On Error GoTo Err_Browse
        
        Dim strFileName As String
        Dim oDialog As Object
    ** the next line is where the program stops with the error message
       Set oDialog = [Forms]![frmNewDatafile]!xDialog.Object
        
        With oDialog                ' Ask for new file location
            .DialogTitle = "Please Select new SASS Premier Scoring Files"
            .Filter = "Access Database(*.mdb;*.mda;*.mde;*.mdw)|" & _
            "*.mdb; *.mda; *.mde; *.mdw|All(*.*)|*.*"
            .FilterIndex = 1
            .ShowOpen
            If Len(.FileName) > 0 Then  ' user responded, put selection into text box on
                [Forms]![frmNewDatafile]![txtFileName] = .FileName
            End If
        End With
    
    Exit_Browse:
        Exit Function
    Hopefully someone can make sense out of this and be able to point me the correct direction.

    Thanks for any help as always this is the best place to find answers.
    Last edited by NeoPa; Oct 31 '09, 12:27 AM. Reason: Please use the [CODE] tags provided.
  • NeoPa
    Recognized Expert Moderator MVP
    • Oct 2006
    • 32669

    #2
    This is all about the xDialog control on your frmNewDatafile form.

    Unfortunately we cannot know what type of control that is (until you tell us of course). Your code is expecting a control which contains an .Object property. This is not something that I'm familiar with. None of the standard controls do as far as I'm aware. It's probably some form of specialist control, in which case we would need to know about it before we can be much help.

    It may be that there is a Reference missing of course. That's always worth checking first for a problem like this. Check in Tools \ References of the IDE (Alt-F11) to see if any are flagged as Missing.

    Comment

    • CD Tom
      Contributor
      • Feb 2009
      • 495

      #3
      Thanks for the reply. I have no idea what the xDialog.object is. I'm using this code from something I got off one of these forums. Now I should also mention that I'm running this on Windows 7 but I don't think that has anything to do with the problem. The message comes up with I bring up the form and also when I click on the button that should allow me to browse for the database I'm looking for.
      What usually happens is when I click on the button if brings up the standard windows browse and allows me to select the database it then places it in a text box called txtFileName I then need to click on another button that will relink all the files in the database to the new location.
      I've checked the references and have nothing missing.
      Any other suggestions?
      Thanks again

      Comment

      • CD Tom
        Contributor
        • Feb 2009
        • 495

        #4
        I just typed the location of the database in the txtFileName field and when I click the relink button everything works. It looks like the browse window isn't working. I'm using another browse function to locate where the user wants to put their backup files. I'm going to try and see it that will work here. I'll get back if I can get it to work. Thanks again for all the help.

        Comment

        • CD Tom
          Contributor
          • Feb 2009
          • 495

          #5
          Ok here's what I've done and it works to a point.
          I'm calling the standard windows open and save module this brings up the standard windows open dialog box, I've set the filter to only bring up *.mdb I then select the file that I wish to use. Here's where I'm now running into problems the file name is located in a var txtFileName but when I return from the module the txtfilename is blank. I've tried setting txtFileName as a Public var but that still doesn't work. How do I get the var from the Module back to the original form.
          The button on the original form has on the Click event =browse() I've tried setting code on that event to call Browse but the txtFileName still comes back null.
          I need your help again. Thanks

          Comment

          • NeoPa
            Recognized Expert Moderator MVP
            • Oct 2006
            • 32669

            #6
            Let me see if I can get this straight :
            You call the function Browse() as the OnClick event procedure of your CommandButton?
            Where is the var txtFileName defined?
            What is var in this context?

            I think it may help to see the code you have as Browse() (if it's different from the code in your OP - I expect it should be).

            Comment

            • CD Tom
              Contributor
              • Feb 2009
              • 495

              #7
              Thanks for the reply hears the Browse code
              Code:
              Public Function Browse()
              
              Dim strFilter As String
              Dim strinputfilename As String
              
              
              strFilter = ahtAddFilterItem(strFilter, "*be.mdb")
              strinputfilename = ahtCommonFileOpenSave( _
                              Filter:=strFilter, OpenFile:=True, _
                              DialogTitle:="Please select an input file...", _
                              Flags:=ahtOFN_HIDEREADONLY)
              
              txtFileName = strinputfilename
              
              Exit_Browse:
                  Exit Function
              Err_Browse:
                  MsgBox err.Description
                  Resume Exit_Browse
              End Function
              I could use either the strinputfilenam e or the txtFileName I was trying both but can't get them to show up on the form that calls Browse.

              Hope this helps.
              Last edited by NeoPa; Nov 2 '09, 10:38 AM. Reason: Please use the [CODE] tags provided.

              Comment

              • CD Tom
                Contributor
                • Feb 2009
                • 495

                #8
                There is a form that has two command buttons one to locate the database and the second to relink once the database has been located. The command button the is used to locate the database is the one that calles the browser routine but when I return to the main form the database location isn't there. Like I mentioned the is a text field where I want the location to appear and that field is called txtFileName. If I just type the database location into that field and select the link command button everything works. I just need to get that location from the browse routine to show up in the text field. I hope this makes sense. Thanks again for your help.

                Comment

                • NeoPa
                  Recognized Expert Moderator MVP
                  • Oct 2006
                  • 32669

                  #9
                  Tom,

                  I'm bemused. Your account is on the verge of being suspended for continuous rule-breaking. I've explained this in exhaustive detail in the series of PMs I've had to send you along with the warning and infraction. In such a situation I'm really surprised that you post code yet again without using the mandatory [ CODE ] tags. I've heard nothing from you explaining that you are having difficulty understanding how to follow the guidelines so I need to understand why this is if I'm to refrain from suspending your account.

                  I'm quite happy to help you with your technical issues, but this problem will not go away until you do something about it. I hope I'm clear.

                  Administrator.

                  Comment

                  • NeoPa
                    Recognized Expert Moderator MVP
                    • Oct 2006
                    • 32669

                    #10
                    Technical answer :
                    I am struggling here as I asked 3 questions which you have replied to with some more pretty incoherent prose instead of specific answers. This is fine if you like posting backwards and forwards. I'm not greatly fussed. If however, you are interested in getting help from us here, you will need to be more precise and accurate with your responses. I spent the time to work out what information I needed to help you. If you ignore this and repeat an attempt to explain it in your own, quiite imprecise words, then we are back at first base. Your last post contains some typos; some missed out words; some words that simply don't fit in the sentence at all (but are somewhat similar to words that might). All in all it is useless as an attempt to pass the information I need and requested. I know you don't know all the right terms - That's why I posted the questions I did. Sure it means you have to do a little work to find the answers. If that's too much then just let us know and we can all stop wasting our time. If, however, you are sincerely interested in getting help, then I suggest you apply yourself a bit more directly to the issue.

                    I'll leave this with you.

                    Comment

                    • CD Tom
                      Contributor
                      • Feb 2009
                      • 495

                      #11
                      I have been playing with this all weekend and have finally got it to work. It basically had to do with making the var public so that they are available to any form. I had done this before but for some reason it didn't work then all of a sudden they started working, go figure!!! Thanks for your help

                      Comment

                      Working...