Page 1 of 2 12 LastLast
Results 1 to 15 of 19
  1. #1
    Bipsy is offline Novice
    Windows 8 Access 2016
    Join Date
    Sep 2022
    Posts
    10

    Error Message: The object doesn't contain the Automation object 'qryQ.'.

    I have a query qryQ, which is designed from two tables, where the RateDate is sorted in descending order with only 1 row to be displayed with the Service Rate for the chosen Service (to be chosen from Form1).

    The got focus event of ServRate of Form1 I have put the code as follows:

    =DLookup([ServRate],[qryQ],[Service]=[OrdService])


    However, when the cursor come to the Rate box in Form1 I get the following Error message.

    The object doesn't contain the Automation object 'qryQ.'. I just cannot understand this. Read it carefully and notice the dot after Q and before '. Its very strange..


    Hope someone can help me resolving this.

    The idea is to get the latest prevailing rate at the data entry level.


    Thanks.



    bipsy

  2. #2
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    You need to surround all within double quotes.
    Why not google the syntax?

    https://support.microsoft.com/en-us/...b-bed10dca5937
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  3. #3
    Bipsy is offline Novice
    Windows 8 Access 2016
    Join Date
    Sep 2022
    Posts
    10
    Done it Sir. The error message is not there now. However, the Service Rate is not appearing in the desired box.
    I really appreciate your help.
    Thank you.

  4. #4
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Well if the code is in an event, you would need
    Me.ServRate = dlookup etc
    Your syntax would be for the control source?

    Again read all of that link.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  5. #5
    Bipsy is offline Novice
    Windows 8 Access 2016
    Join Date
    Sep 2022
    Posts
    10
    Tried it, but doesn't work!! ServRate is unbound control. That is why it need the Rate from the qryQ's field ServRate.

  6. #6
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    Show your dlookup code code

    Within code tags please.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  7. #7
    Join Date
    Jan 2017
    Location
    Swansea,South Wales,UK
    Posts
    6,575
    If you look at that link, it concatenates the value of the control. You would need to do that in the code as well. Sorry, my bad.
    Please use # icon on toolbar when posting code snippets.
    Cross Posting: https://www.excelguru.ca/content.php?184
    Debugging Access: https://www.youtube.com/results?sear...bug+access+vba

  8. #8
    Bipsy is offline Novice
    Windows 8 Access 2016
    Join Date
    Sep 2022
    Posts
    10
    On the GotFocuss Even I have the following expression.

    "Me.ServRate"=DLookUp("ServRate","qryQ","Service"= "OrdService")

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    Did you even look at the link provided by Welshgasman?

    Me.ServRate should not be between quote marks.

    What is OrdService - a field or a textbox or both? Is Service a text type field?
    Code:
    Me.ServRate = DLookUp("ServRate", "qryQ", "Service='" & Me.OrdService & "'")
    Instead of VBA, put the DLookup expression in ServRate ControlSource property.

    I doubt you even need this DLookup but I would have to review db. If you want to provide for analysis, follow instructions at bottom of my post.
    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.

  10. #10
    Bipsy is offline Novice
    Windows 8 Access 2016
    Join Date
    Sep 2022
    Posts
    10
    Which particular link please Sir?
    Thank you.

  11. #11
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    The one in post #2.
    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.

  12. #12
    Bipsy is offline Novice
    Windows 8 Access 2016
    Join Date
    Sep 2022
    Posts
    10
    OrdService is a textbox on Form1. The value of it will determine the which Service the qryQ will search for and its Rate, that Rate will be put on the unbound ServRate box.

    In the Control source of the box I have put
    Me.ServRate=DLookUp("ServRate","qryQ","Service"="O rdService")

    Its is till not working.

    Thanks for your help. Please bear with me for I am a very beginner.

  13. #13
    June7's Avatar
    June7 is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,772
    You did not follow my example nor answer questions. Again, review the info found in link referenced in post #2.

    Is OrdService a control on form or is this literal text? If the latter:

    Me.ServRate = DLookUp("ServRate", "qryQ", "Service='OrdService'")
    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.

  14. #14
    Bipsy is offline Novice
    Windows 8 Access 2016
    Join Date
    Sep 2022
    Posts
    10
    ControlSource now has =[Me].[ServRate]=DLookUp("ServRate","qryQ","Service='" & [Me].[OrdService] & "'")

    When the cursor comes on the textbox ServRate it brings #Name error.

  15. #15
    Bipsy is offline Novice
    Windows 8 Access 2016
    Join Date
    Sep 2022
    Posts
    10
    It is a textbox on Form1.

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 7
    Last Post: 05-23-2019, 07:18 AM
  2. Replies: 2
    Last Post: 07-20-2017, 07:20 AM
  3. Replies: 1
    Last Post: 12-27-2013, 01:59 PM
  4. Replies: 1
    Last Post: 07-02-2013, 08:41 AM
  5. Replies: 3
    Last Post: 11-02-2010, 10:14 AM

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