Solved: Code to select a recordset is not working

Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

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
 

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
 

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?
 

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.
 

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.
 
Status
This thread has been Locked and is not open to further replies. Please start a New Thread if you're having a similar issue. View our Welcome Guide to learn how to use this site.

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

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 807,865 other people just like you!

Latest posts

Members online

Top