1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Solved: Code to select a recordset is not working

Discussion in 'Business Applications' started by Jiimandjo, Jan 12, 2011.

Thread Status:
Not open for further replies.
Advertisement
  1. Jiimandjo

    Jiimandjo Thread Starter

    Joined:
    Nov 30, 2010
    Messages:
    10
    I placed the following code into my Combo box. Combo is intended to find a siingle recordset. The code is placed in the After Update of Properties. On update, I get the error:Access cannot find the object 'Me'. What do I need to fix this?

    Code:

    Me.RecordsetClone.Findfirst "[Quest] = " & Me![Combo21]
    Me.Bookmark = Me.RecordSetClone.Bookmark
     
  2. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    Why not use the Combo Wizard to create the correct code for you?
    It would normally look like this
    ' Find the record that matches the control.
    Dim rs As Object

    Set rs = Me.Recordset.Clone
    rs.FindFirst "[Quest] = '" & Me![Combo21] & "'"
    If Not rs.EOF Then Me.Bookmark = rs.Bookmark
     
  3. Jiimandjo

    Jiimandjo Thread Starter

    Joined:
    Nov 30, 2010
    Messages:
    10
    I tried your suggestion.

    I tried to use the Combo Wizard on my form. My form is a tabbed form with 10 tabs. The form itself works fine. but the combo box did not do what I wanted it to do. I would like to add a combo box that will search for a record so that the record can be updated. The combo box wizard did not give me the third option to find a record on my form based on the selection of my combo box.

    I was able to get the combo box to work correctly if I made a single form with no subforms or tabs.

    Do you have any ideas on finding a workable solution?
     
  4. OBP

    OBP

    Joined:
    Mar 8, 2005
    Messages:
    19,895
    It suggests that your Mainform does not have searchable data on it. If you add it (even invisible) it should then work.
     
  5. Jiimandjo

    Jiimandjo Thread Starter

    Joined:
    Nov 30, 2010
    Messages:
    10
    Thanks, your reply encouraged me to think that this problem was solvable. I Added an "AfterUpdate" macro "SearchforRecord" with a condition that I found on a combobox that worked for me:
    ="[Quest] = " & Str(Nz([Screen].[ActiveControl],0)). It now works.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/974282

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice