Results 1 to 13 of 13
  1. #1
    Starter-4-10 is offline Novice
    Windows 10 Access 2003
    Join Date
    Dec 2016
    Posts
    27

    "There is no object in this control" on Startup. How find which control's bad? (asks total novice)

    Search of this site shows mtrcar1 asking What does noobjectin this control mean? in 2006. And getting zero replies.



    The problem for us novices is, that while that msgbox shows, nothing but the msgbox responds to a click. So we click Ok, and get a crippled database.

    C'mon, baby brother needs your advice!





  2. #2
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    have a look at this link for a number of reasons

    https://nortonsafe.search.ask.com/we...doi=2016-09-01

  3. #3
    Starter-4-10 is offline Novice
    Windows 10 Access 2003
    Join Date
    Dec 2016
    Posts
    27
    Thank you. Your links show it can be a complicated matter to resolve, beyond my skills.

    But is there no easy way to find out what Access is complaining about? What line of code, what control, perhaps even what object? Perhaps (wild guess) by Steps?

  4. #4
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    click the debug button instead of OK and it will take you to the vba window and highlight the offending line.

    If you are using macros, regret I can't help, I don't use them, but perhaps they do something similar

  5. #5
    Starter-4-10 is offline Novice
    Windows 10 Access 2003
    Join Date
    Dec 2016
    Posts
    27
    Thanks ... but as I said, "The problem for us novices is, that while that msgbox shows, nothing but the msgbox responds to a click." Nothing. Except Microsoft's 'don't click here' jingle.

  6. #6
    John_G is offline VIP
    Windows 7 32bit Access 2010 32bit
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    This is just a guess - but does the startup form have an image control on it, or perhaps some other type of "container" control? The error suggests you have code which is trying to manipulate something in a "container" which has nothing in it yet.

    Can you open the database without opening the startup form (hold down the shift key)? If that works, then try opening the startup form to see if you still get the error. If you do, then there is probably something in the On Open or On Load event code that is causing it.

  7. #7
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    It would help if you provided more information

    1. are you using vba or macros?

    2. if using vba do you have 'Option Explicit' at the top of the module, just below 'Option Compare Database'. If not, in form design view, vba window, put it in then click the compile option on the debug menu. What errors, if any, do you get?

    3. Do you get an error message box like this (error messages may be different)
    Click image for larger version. 

Name:	Capture.JPG 
Views:	21 
Size:	15.3 KB 
ID:	26772


    or like this?
    Click image for larger version. 

Name:	Capture1.JPG 
Views:	21 
Size:	15.8 KB 
ID:	26773

    4. Your thread title says 'on Startup'. Does this mean when you open Access, or when a specific form is opened?

    5. if the latter, how is the form being opened? by opening from the navigation window?, by autoexec macro or ordinary macro? by opening from another form?

    6. If by macro or from another form, what code are you using? - copy and paste it in your response

    7. In the form that generates the message, please provide the code you have (if any) in the following events: form open, form load, form resize, form current

    All questions need to be answered before I can provide more help

  8. #8
    Starter-4-10 is offline Novice
    Windows 10 Access 2003
    Join Date
    Dec 2016
    Posts
    27
    Thanks very much, John_G and Ajax.

    Alex’s question 2 SOLVED my “There is no object in this control” problem. Hero! But maybe John_G’s thinking is nearer the cause of the remaining problem, the non-functioning images? So I’ve left my full reply below, in case there's a useful clue.

    But you’ve already been very generous with your time; if you've had enough, please feel free to drop this novice.

    --------------------

    The database works fine in Access 2002/XP, but not under Access 2003/Win 10. There may be one or two Active X involved, eg Microsoft Common Dialog Control 6.0 (sp3) ticked in References.

    The first form to be opened is frmMainMenu. It has no images. Then frmItems is opened, which has 4 photo frames per record, linked to 4 photo folders. Double-click opens a Yes/No/Cancel msgbox, Yes should opens a photo folder to change the photo. Under Win10, there’s no access to the photo folders.

    Opening the database holding shift: no problem, Database Window opens, showing Module Basinitialise (code below), which contains the line If Mid(MyDB.Name, intCount, 1) = "" Then - with Mid highlighted and msgbox “Compile Error Can’t find project or library”.

    References shows MISSING: Microsoft Office XP Web Components. Untick that, return to Database Window, select Macros, double-click Autoexec. “There is no object in this control”. OK. “There is no object in this control”. OK. Database opens as in XP, Double-Click opens Yes/No/Cancel msgbox opens, but Yes does nothing, though the table listing the currently-chosen images looks fine.

    In the Code, CTRL+F, select Current Project, neither On Open or On Load found.

    Answering Ajax (with links to what’s above in this reply)


    1. Both. Autoexec (macro) “calls” Basinitialise (module, in vba). Forms have vba.



    1. Yes, got 'Option Explicit' in Basinitialise. But did compile anyway. In frmMainMenu, a function opening a redundant form. “Compile error Sub or Function not defined”. Put a ‘ note on every line. Compile again, no problems. Run Autoexec; database opened – WITHOUT “There is no object in this control”. But same photo-management problems.



    1. Only as in 2 above.



    1. When a specific database is opened.



    1. Same problems, whichever way … I think.



    1. Autoexec (RunCode GetDBPath () in code below, OpenForm frmMainMenu)




    Option Compare Database
    Option Explicit

    Public strDBPath As String
    Public strPhotoDir1 As String
    Public strPhotoDir2 As String
    Public strPhotoDir3 As String
    Public strPhotoDir4 As String 'line added DB
    Public strGraphicDir As String

    Public intFormHeight As Integer
    Public intFormWidth As Integer

    Function GetDBPath()

    Dim MyDB As Database
    Dim intTitleLength, intDBLength, intCount As Integer

    Set MyDB = CurrentDb() 'MyDB now means "this database"

    intDBLength = Len(MyDB.Name)

    For intCount = intDBLength To 1 Step -1
    If Mid(MyDB.Name, intCount, 1) = "" Then
    Exit For
    End If
    Next

    intTitleLength = intDBLength - intCount

    strDBPath = Left(MyDB.Name, Len(MyDB.Name) - intTitleLength)
    strPhotoDir1 = strDBPath & "dbase photos1"
    strPhotoDir2 = strDBPath & "dbase photos2"
    strPhotoDir3 = strDBPath & "dbase photos3"
    strPhotoDir4 = strDBPath & "dbase photos4" ' line added DB
    strGraphicDir = strDBPath & "dbase graphics"
    'MsgBox "Autogenerated paths:@Database: " & strDBPath & "@Photos: " & strPhotoDir4

    Debug.Print "Exit Basinitialise" 'Tracking DB

    End Function

    7. Searched with CTRL+F Current Project. None of these found.

  9. #9
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    not sure what this is supposed to do

    Code:
    For intCount = intDBLength To 1 Step -1
            If Mid(MyDB.Name, intCount, 1) = "" Then
                Exit For
            End If
        Next
    so far as I am aware, you cannot have a ZLS ("") as a character, so intcount is always going to end up equal to 1

    So lets say mydb.name has a length of 20 characters

    intDBLength = Len(MyDB.Name)

    ergo intDBLength=20

    you then calculate intCount - which will equal 1

    you then calculate

    intTitleLength = intDBLength - intCount

    so intTitleLength=20-1=19

    next

    strDBPath = Left(MyDB.Name, Len(MyDB.Name) - intTitleLength)

    which is Left(MyDB.Name,20-19) - i.e. the first character

  10. #10
    Starter-4-10 is offline Novice
    Windows 10 Access 2003
    Join Date
    Dec 2016
    Posts
    27
    Vaguely grasp your explanation. As you know, this code works in Access 2000/XP, but causes “Compile Error Can’t find project or library” in Access 2003/Win 10 until Reference to MISSING: Microsoft Office XP Web Components is unticked. Could this code be related to the inaccessibity (in 2003/Win10) of photo folders? In some circumstances, Access says 'This database needs OWC10.dll version 2'. Because I unticked?

    In case it helps you, here's the code running the photo management (btw, I feel like a boy scout getting instructions by semaphore from a brain surgeon. I assume I'm not allowed to send you the 200 meg database? And why 200 Meg for a few tables?)

    Private Sub fraPhoto3_DblClick(Cancel As Integer)

    On Error GoTo Err_fraPhoto3_DblClick

    Dim strPath As String
    Dim iResponse As Integer

    iResponse = vbYes
    If Me.Photo3 <> "" Then iResponse = MsgBox("Do you want to Replace image (Yes), Remove image (No), or Leave image (Cancel)?", vbYesNoCancel)

    If iResponse = vbYes Then
    ctlCommonDialog.InitDir = strPhotoDir3
    ctlCommonDialog.ShowOpen
    strPath = ctlCommonDialog.FileTitle
    Me.Photo3 = strPath
    Me.fraPhoto3.Picture = strPath
    ElseIf iResponse = vbNo Then
    Me.Photo3 = Null
    Me.fraPhoto3.Picture = ""
    End If
    Err_fraPhoto3_DblClick:


    End Sub





  11. #11
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    Your initial question was about 'no object in this control'

    This appears to be solved but you then moved on to a function called getpath. Is this in your Basinitialise module? if so what calls it.

    but without an apparent resolution, you are now talking about a double click event.

    So with regards your last post - the double click event, please put this in a new thread. And please clarify on this thread what the issue is with your getpath function

  12. #12
    Starter-4-10 is offline Novice
    Windows 10 Access 2003
    Join Date
    Dec 2016
    Posts
    27
    Understood. Thanks for all your help. If you'd like to mark this thread as solved, that's fine by me.

  13. #13
    CJ_London is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,426
    you can do that yourself - go to the top of the thread, click on thread tools and select 'Mark this thread as solved'

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 06-24-2015, 11:46 AM
  2. Replies: 5
    Last Post: 09-05-2014, 12:59 PM
  3. Exporting to .dbf "can't find object" error
    By fedyazar in forum Import/Export Data
    Replies: 6
    Last Post: 03-27-2013, 02:41 PM
  4. Replies: 1
    Last Post: 04-14-2011, 03:46 PM
  5. "doCmd - can't find object"
    By drmcfall in forum Access
    Replies: 1
    Last Post: 08-18-2009, 09:41 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums