Fill from Group by Qry

  • Thread starter Thread starter Brent Fanguy
  • Start date Start date
B

Brent Fanguy

Ok Guru's. I need to know how to do the following:

I have a form that has a combo box that uses a group by
qry for its data. (basically i am selecting all the unique
records from a table). I know i can store one field from
the combo box, but i want to take the record they pick and
fill the fields on the form for them. (this way if they
have entered a record like the one they are on the just
have to pick it from the combo box and it will fill the
form in for them. if not they manually enter the info,
save and next time it will show up on the list.

TIA!!!
 
Brent said:
I have a form that has a combo box that uses a group by
qry for its data. (basically i am selecting all the unique
records from a table). I know i can store one field from
the combo box, but i want to take the record they pick and
fill the fields on the form for them. (this way if they
have entered a record like the one they are on the just
have to pick it from the combo box and it will fill the
form in for them. if not they manually enter the info,
save and next time it will show up on the list.


You can use the combo box's AfterUpdate event to run code
that populates the other controls.

Make sure the combo box's RowSource query includes all the
fields you want to copy to other controls. E.g.
SELECT LastName, Address, City
FROM sometable
GROUP BY LastName, Address, City
ORDER BY LastName

Then you can use the combo box's Column property to refer to
the other fields. E.g.
Me.txtaddress = Me.thecombo.Column(1)
Me.txcity = Me.thecombo.Column(2)
 
Back
Top