Results 1 to 5 of 5
  1. #1
    graccess is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    78

    Question Object doesn't contain the Automation object 'Form'


    Having some difficulty fixing this issue in my macro. I believe it's coming from the 'Where Condition' = ="[Companytable].[CompanyID]=" & Nz([CompanyID],0)
    This is part of an OpenForm operation. Any suggestions on how to debug or what I should be considering would be helpful!

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Review http://support.microsoft.com/kb/89610

    Maybe remove the = sign.

    Maybe remove [Companytable].

    Consider VBA instead.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    graccess is offline Advanced Beginner
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jan 2014
    Posts
    78
    Thanks. The removal of the = sign helped but I'm still getting an error with the query I'm running within the FROM clause of my SQL statement.

    SELECT IIf(IsNull([Ticker]),IIf(IsNull([Quickhit]),[Company],[Quickhit]),IIf(IsNull([Quickhit]),[Ticker],[Ticker] & ", " & [Quickhit])) AS [File As], IIf(IsNull([Ticker]),IIf(IsNull([Quickhit]),[Company],[Quickhit]),IIf(IsNull([Quickhit]),[Ticker],[Quickhit] & " " & [Ticker])) AS CompanyName, ResearchNotes.*, Companytable.*
    FROM Companytable LEFT JOIN ResearchNotes ON Companytable.CompanyID = ResearchNotes.CompanyID
    ORDER BY IIf(IsNull([Ticker]),IIf(IsNull([Quickhit]),[Company],[Quickhit]),IIf(IsNull([Quickhit]),[Ticker],[Ticker] & ", " & [Quickhit])), IIf(IsNull([Ticker]),IIf(IsNull([Quickhit]),[Company],[Quickhit]),IIf(IsNull([Quickhit]),[Ticker],[Quickhit] & " " & [Ticker]));


    The error reads, The specified field '[CompanyID]' could refer to more than one table listed in the FROM clause of your SQL statement. I do have this field listed in the two tables here, ResearchNotes and CompanyTable and these two tables are joined by the field CompanyID. Note sure how else to get around that.

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    I am baffled. I can't see any reason for that error.

    Try rebuilding the query from scratch, try copy/paste the sql into a new query object.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 7 64bit Access 2010 32bit
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe if you add the two fields.....

    Code:
    SELECT IIf(IsNull([Ticker]),IIf(IsNull([Quickhit]),[Company],[Quickhit]),IIf(IsNull([Quickhit]),[Ticker],[Ticker] & ", " & [Quickhit])) AS [File As], IIf(IsNull([Ticker]),IIf(IsNull([Quickhit]),[Company],[Quickhit]),IIf(IsNull([Quickhit]),[Ticker],[Quickhit] & " " & [Ticker])) AS CompanyName, ResearchNotes.*, Companytable.*, Companytable.CompanyID, ResearchNotes.CompanyID

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

Similar Threads

  1. Replies: 1
    Last Post: 12-27-2013, 01:59 PM
  2. Replies: 1
    Last Post: 07-02-2013, 08:41 AM
  3. Replies: 1
    Last Post: 04-10-2012, 08:48 AM
  4. Replies: 3
    Last Post: 11-02-2010, 10:14 AM
  5. Replies: 1
    Last Post: 08-05-2010, 12:11 PM

Tags for this Thread

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