Finding data

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

Guest

I have a table that records each person's customerID, name, address,
donation...How do I set up a query or form that when I type in the customerID
or the person's name, all other information will show up? Thanks
 
1. create a for
2. bound the form to the table you created
Select * From MyTable Where customerId=forms![FormName]![CustomerID] (see
part four)
3. create all the fields in the form, bound the text boxes to the fields
from the table.
4. create another field, unbounded, where the user can enter the customerID
5. on the after update event of the customerid (4), enter the code

IF isnull(dlookup("CustomerID","MyTable", "CustomerID = " & me.customerID))
then
msgbox "Customer does not exist"
else
me.requery
end if

I hope it will work up
 
Why not use a ComboBox using the wizard and select "Find a record on my form
based on a value I selected in my ComboBox"?

--
HTH




Ofer said:
1. create a for
2. bound the form to the table you created
Select * From MyTable Where customerId=forms![FormName]![CustomerID] (see
part four)
3. create all the fields in the form, bound the text boxes to the fields
from the table.
4. create another field, unbounded, where the user can enter the
customerID
5. on the after update event of the customerid (4), enter the code

IF isnull(dlookup("CustomerID","MyTable", "CustomerID = " &
me.customerID))
then
msgbox "Customer does not exist"
else
me.requery
end if

I hope it will work up
Tim said:
I have a table that records each person's customerID, name, address,
donation...How do I set up a query or form that when I type in the
customerID
or the person's name, all other information will show up? Thanks
 
It the same thing text box or combo box, just make it unbound other wise it
will try and change the data in customer id, if you use a combo you wont need
to use the dlookup, because we know that the customer exist.
the find will find the record, but you need to use more code. also all the
data will still be there, so if the user will press page down he will move to
the next customer.



Joe said:
Why not use a ComboBox using the wizard and select "Find a record on my form
based on a value I selected in my ComboBox"?

--
HTH




Ofer said:
1. create a for
2. bound the form to the table you created
Select * From MyTable Where customerId=forms![FormName]![CustomerID] (see
part four)
3. create all the fields in the form, bound the text boxes to the fields
from the table.
4. create another field, unbounded, where the user can enter the
customerID
5. on the after update event of the customerid (4), enter the code

IF isnull(dlookup("CustomerID","MyTable", "CustomerID = " &
me.customerID))
then
msgbox "Customer does not exist"
else
me.requery
end if

I hope it will work up
Tim said:
I have a table that records each person's customerID, name, address,
donation...How do I set up a query or form that when I type in the
customerID
or the person's name, all other information will show up? Thanks
 
Back
Top