Connecting Tech Pros Worldwide Forums | Help | Site Map

Object in this control

Member
 
Join Date: Feb 2009
Location: Portland, OR
Posts: 64
#1: 4 Weeks Ago
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
Expand|Select|Wrap|Line Numbers
  1. Public Function Browse()
  2.     ' Prompts user for Cowboy Action database file name
  3.     On Error GoTo Err_Browse
  4.  
  5.     Dim strFileName As String
  6.     Dim oDialog As Object
  7. ** the next line is where the program stops with the error message
  8.    Set oDialog = [Forms]![frmNewDatafile]!xDialog.Object
  9.  
  10.     With oDialog                ' Ask for new file location
  11.         .DialogTitle = "Please Select new SASS Premier Scoring Files"
  12.         .Filter = "Access Database(*.mdb;*.mda;*.mde;*.mdw)|" & _
  13.         "*.mdb; *.mda; *.mde; *.mdw|All(*.*)|*.*"
  14.         .FilterIndex = 1
  15.         .ShowOpen
  16.         If Len(.FileName) > 0 Then  ' user responded, put selection into text box on
  17.             [Forms]![frmNewDatafile]![txtFileName] = .FileName
  18.         End If
  19.     End With
  20.  
  21. Exit_Browse:
  22.     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.

NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,766
#2: 4 Weeks Ago

re: Object in this control


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.
Member
 
Join Date: Feb 2009
Location: Portland, OR
Posts: 64
#3: 4 Weeks Ago

re: Object in this control


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
Member
 
Join Date: Feb 2009
Location: Portland, OR
Posts: 64
#4: 4 Weeks Ago

re: Object in this control


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.
Member
 
Join Date: Feb 2009
Location: Portland, OR
Posts: 64
#5: 4 Weeks Ago

re: Object in this control


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
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,766
#6: 4 Weeks Ago

re: Object in this control


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).
Member
 
Join Date: Feb 2009
Location: Portland, OR
Posts: 64
#7: 4 Weeks Ago

re: Object in this control


Thanks for the reply hears the Browse code
Expand|Select|Wrap|Line Numbers
  1. Public Function Browse()
  2.  
  3. Dim strFilter As String
  4. Dim strinputfilename As String
  5.  
  6.  
  7. strFilter = ahtAddFilterItem(strFilter, "*be.mdb")
  8. strinputfilename = ahtCommonFileOpenSave( _
  9.                 Filter:=strFilter, OpenFile:=True, _
  10.                 DialogTitle:="Please select an input file...", _
  11.                 Flags:=ahtOFN_HIDEREADONLY)
  12.  
  13. txtFileName = strinputfilename
  14.  
  15. Exit_Browse:
  16.     Exit Function
  17. Err_Browse:
  18.     MsgBox err.Description
  19.     Resume Exit_Browse
  20. End Function
I could use either the strinputfilename or the txtFileName I was trying both but can't get them to show up on the form that calls Browse.

Hope this helps.
Member
 
Join Date: Feb 2009
Location: Portland, OR
Posts: 64
#8: 4 Weeks Ago

re: Object in this control


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.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,766
#9: 4 Weeks Ago

re: Object in this control


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.
NeoPa's Avatar
Administrator
 
Join Date: Oct 2006
Location: London - UK
Posts: 15,766
#10: 4 Weeks Ago

re: Object in this control


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.
Member
 
Join Date: Feb 2009
Location: Portland, OR
Posts: 64
#11: 4 Weeks Ago

re: Object in this control


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
Reply