Find customer by customernumber using sql ?

S

SpookiePower

I have made a form showing the info about my customer in textboxes. But
insted of going
through each one of the customers, by clicking on the little arrow, I
want the
user to enter a customernumber in a textbox and then show the customer
info
in the textboxes on the form.

I have made a query that shows the customer info, and I have put a
button on my form, and
connected the button to the query. When I push the button a new form is
opening and all my
customer is showing.

When I click the button I want to show the one customer that is entered
into a textbox, and
not showing up in a new form, but in the textboxes already placed on
the main form.

Someone who can help me ?



www.photo.activewebsite.dk
 
A

Al Camp

Spookie,
You can do a query if you want, but while your with the Customer
recordset, a Find would be much easier...
I usually use a simple unbound combobox to select a Customer by Name, and
then find the record within the recordset via the CustomerID value. You
could alter it easily to select and find by ID if you want.
I have a sample file that demonstates that, called ComboQuickFind. (V97
and V2003)
See Access Tips at the link below.
 
S

SpookiePower

I'm a bit confused about how you do this. I can see that you have
something called
"Row Source" in the combobox containing a query. I cant see who this
query connect to the two textboxes and then, when I place a
combobox/textbox on my form, there is not something called "Row Source"
where I can put a query.
 
A

Al Camp

Spookie,
The query behind the combo box allows the user to select a unique
CustomerID for Access to find.
The AfterUpdate code of the combo performs that Find.

Private Sub cboFindRecordID_AfterUpdate()
DoCmd.GoToControl "RecordID"
DoCmd.FindRecord cboFindRecordID
DoCmd.GoToControl "LastName"
End Sub

If the Combo control you placed on your form doesn't show a RowSource
property, then make sure that you have the ALL tab selected in the
Properties box, and look again.
If it's still not there, then it's not a Combobox. All Combos and
ListBoxes have a RowSource, where a table, query, or value list determines
what choices will be displayed to the user for selection.
 
Top