View Full Version : getting fields to populate based on combo box selection


Rebekah
09-18-2000, 03:16 PM
i am trying to do something i am sure isn't difficult.
What i want to do is enable someone doing data entry to begin typing in the last name of a property owner and, once they've found the correct record, hit return and have all the fields populate automatically.
this would seem easy and yet, i seem unable to get it to work.

what happens is you can scroll down (i am using a combo box)or begin typing and the records in the rest of the fields seem to jump around. if you hit return to select the last name for reasons i don't understand, the records seem to jump but not to the one you want.

also, an additional complication is that i want to be able to change the filter on the forms (which i do through a query) and have this combo box only populate with records that are a part of the querry.

how do i do this?

i tried some Me! comand (what is a me comand)
and it didn't work any better tha any of the other things i had tried.

any and all help woul dbe appreciated,
if there is a website i should check out - please let me know.

rebekah

chrismcbride
09-18-2000, 05:07 PM
The way to find a Record based on the value of a Combo bow is to use the RecordsetClone and Bookmark Poperties of your form. Set the Combo box Control Source to a SELECT query that contains the property owner's UID and name. Set the Bound Column to the UID. In the AfterUpdate of the Combo box, place these lines
Me.Recordsetclone.FindFirst "UID = " & me.cboPropertyOwner
me.Bookmark = Me.Recordsetclone.Bookmark
This assumes that there is a numeric Unique Identifier for the Property Owner records and that that field in the table is named UID. If you need to use a string instead of the number, then change the first line to
"UID = '" & me.cboPropertyOwner & "'"
P.S. Me indicates whatever the currently active object is. Very handy replacement for long paths like Forms!frmWhatever!subformWhatever!ctlWhatever
Enjoy!
Chris