How do I use a query to populate a form

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a query that i want to use to look up parts by part number, every
part has 20 related field in this query, i want to use a textbox to type
the part number and use a command button to execute the search that will then
populate the remaining fields, how should this be done
 
Hi Mike,

Have the form record source set to the query, and have your fields on your
form bound to the appropriate fields in your query. Have an unbound text box
at the start of your form, and have an after update event that fires like
this:

me.recordsetclone.findfirst("[PartNumber]=" & me.numPartNumber)
me.recordset.bookmark = me.recordsetclone.bookmark

Note that this example assumes PartNumber is a numeric field. Use single
quotes to delimit the Part Number if it's a text field.

Hope this helps.

Damian.
 
Back
Top