check for a value displayed in a subform

I have a subform on a main form that displays query results.  It displays 4 fields of data, which is also the number of fields in the table that is being queried.

One of the comboboxes on the main form is tied to another table that lists abbreviations of all states in the United States.

When the user makes a selection from that combo box, a Docmd.Requery is invoked and the query results for the selected state are displayed in the subform (the query gets the value to look up from the selection made in the combobox)

So, for example, let's say the user opens up the main form and selects 'NY' from the combobox.    The query will return results that look something like this in the subform:

Field1        Field2        Field3         Field4
NY             whatever   whatever   whatever
NY             whatever   whatever   whatever
NY             whatever   whatever   whatever

Notice that only 'NY' records are returned.  Without going into too much detail about why I need to do this, what I'm trying to accomplish is, once query results are already displayed on the screen (use the NY records above as an example),  I want to be able to detect if a subsequent selection from the combobox is different from what's already displayed on the screen before allowing the query to run again.   Say, for example the 'NY' records are already displayed.  If the user then selects 'CA', I want to be able to detect that the combobox selection (which happens to be 'CA') is different than the data in Field1 of the query results currently displayed.

I know I wrote a book trying to explain this but all I'm trying to do in plain English is:

If combobox selection <> data in Field1 of subform (it doesn't matter which row is looked at because the values in Field1 of the query results will all contain the same value)  then
msgbox "You selected a different state than the one currently being worked on. Would you like to switch states or cancel your selection?"  blah blah blah

Thank you
Who is Participating?
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.

You would you do something like this:
If Me.NameOfComboBox <> Me.NameOfSubformControl.Form!Field1 Then

Open in new window


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
dbfromnewjerseyAuthor Commented:
thank you
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.