MS Access 2013 Subform Search

As the title implies, I have a main form and a subform i.e frmMain, frmMain_sf with a Combo Box  on the frmMain listing all of the records listed in frmMain_sf. The record source for the subform is a stored query with no record source for frmMain.

I want to select a value in the Combo Box and go to that record on the subform.  I would also like to highlight the record found in some manor i.e. different row color.

Help anyone?
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

To go to your selected record, add something like this in your combo box's AfterUpdate event:
    With Me.frmMain_sf.Form.RecordsetClone
        .FindFirst "[UniqueKeyField] = '" & Me.cmbNameOfComboBox & "'"
        If Not .NoMatch Then
            Me.frmMain_sf.Form.Bookmark = .Bookmark
        End If
    End With

Open in new window

If the UniqueKeyField in is a Numeric data type, change the FindFirst line to this instead:
.FindFirst "[UniqueKeyField] = " & Me.cmbNameOfComboBox

To highlight a record, you can use Conditional Formatting.  Set the rule for a textbox in your continuous form to:
Expression Is and [UniqueKeyFIeld] = Parent.[cmbNameOfComboBox], and select your highlight color.

Then add this line to your combo box's AfterUpdate Event:

If you want to highlight a whole row, then use an unbound textbox for your conditional formatting and make it span the whole row, put it behind all the other textboxes and change the background properties of the other textboxes to Transparent.


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
SpaceCoastLifeAuthor Commented:
Search works great. Is there a way to change the row color of the selected row?
IT Pros Agree: AI and Machine Learning Key

We’d all like to think our company’s data is well protected, but when you ask IT professionals they admit the data probably is not as safe as it could be.

Did you miss my second posting?
SpaceCoastLifeAuthor Commented:
I did, sorry.  Let me check it out
SpaceCoastLifeAuthor Commented:
Pretty clever! Thanks for the help.
Your welcome.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.