searching data

H

holler1

Hello,
I have MDB, and I have form for every table.
The MDB is for CRM.
I want to know how to write syntax to make search in some field.
I mean that, if I have Customer form, that his details are:
cust_id,cust_name,cust_address etc.
I want to search for some customer by typing his id in cust_id field and it
will give an output in all his fileds at the specific form.
I hope that I succed to explain the problem.
Thanks ahead
 
A

Allen Browne

A simple way to do this is to add a combo where you can select the client
whose record you want to see.

Details:
Using a Combo Box to Find Records
at:
http://allenbrowne.com/ser-03.html

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
news:[email protected]...
 
H

holler1

Is that mean that when I type ID of any customer, it will give an output of
all his fields in that form?
Should I copy and paste this VB syntax as it is?
 
A

Allen Browne

Yes: you can show the ID if you wish, or hide the ID and choose the company
by name.

You will need to substitute your field names into the code.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
 
H

holler1

I think that we missunderstood each other,
I don't want just to show the ID, I want to get an output of all the
Customer for, when "'m typing customer's ID.
 
R

Rick Brandt

Hello,
I have MDB, and I have form for every table.
The MDB is for CRM.
I want to know how to write syntax to make search in some field.
I mean that, if I have Customer form, that his details are:
cust_id,cust_name,cust_address etc.
I want to search for some customer by typing his id in cust_id field
and it will give an output in all his fileds at the specific form.
I hope that I succed to explain the problem.
Thanks ahead

If you have a standard bound form with bound controls then the purpose of those
controls is to show you the data in the fields for the current record and to
provide a mechanism to change the data in those fields by making entries into
the controls.

You cannot use those SAME controls to do searches because as soon as you make a
change you are altering the data in the current record. What you need is one or
more *separate and unbound* controls whose purpose is to perform searches. The
entry made in such controls won't affect your existing data (since they are
unbound) and you can use code in their AfterUpdate event to either navigate to
the first matching record in your form or to apply a filter to the form to show
all matching records.

Does this accurately describe what you want to do? The navigation code will be
written for you by the ComboBox wizard. Just drop a new one on the form in
design view with the Toolbox wizard enabled and choose the third option which
will be something like "find records matching my selection". That will give you
a ComboBox from which you can select an ID and the form will be auto-navigated
to the first record with that ID.
 
A

Allen Browne

I assume you want to find and display a record.

The suggestion is to use an unbound combo to find the record. Once you have
found it, all the other controls in the form will display the values of the
field for that record.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.

Reply to group, rather than allenbrowne at mvps dot org.

message
 
Top