View Full Version : how to do this,? help me plz


deepbreath
06-09-2001, 05:05 AM
i have list of contacts containing their job description as well. many people have same jobs. how can i find people according to their job. i.e many can be doctors. so i want to make a search form, in which a list box displays all the jobs and when you select any job like doctor, it displays all the people who are doctor in second box. and on clicking on the name it takes you to their record. can you give me a example . urgently needed.
will greatly appreciate.

jimbrooking
06-09-2001, 05:28 AM
Sigh - tis will take longer to explain than to do.

An approach:

Define a table "tblSpecialties" containing a row for each job, say "Gastroenterology", "Internal Medicine", "Psychiatry", etc.

The field containing the job/specialty will be the record source for a combo box called cboSpecialty on the form.

Define a lookup query that will look something like "SELECT* FROM tblEveryone WHERE JobDescription LIKE *" & Forms!frmMyForm!cboSpecialties & "*;". Use this query as the RecordSource for a subform on the form containing cboSpecialty. The subform should contain a field for the person's name and a field for the description.

Use the AfterUpdate event for cboSpecialty to Requery the Subform. Then, whenever the user selects a new specialty, the subform will be updated to display only persons with that specialty name/term in their Description field.

If someone clicks on the person's name on the subform, you can use the OnClick event to open a form (or a constructed Msgbox, if the amount of information is reasonably small and it's read-only) to display all the information about the person.

deepbreath
06-09-2001, 07:56 AM
i really appreciate, but may be i am too junior for this, could you plz help in detail steps. i tried but it did not worked for me.
thanx once again

jimbrooking
06-09-2001, 08:41 AM
I'll see if I can gin something up and email it to you. Is your email correct on this site?

deepbreath
06-09-2001, 08:38 PM
oh great, thanx a lot jim, i really appreciate this. i also send you a email before i got your email,

deepbreath
06-10-2001, 12:09 AM
yeeeeeh it worked great for me. thanks, it really saved me a lot of trouble. now can you put a check box on the subform in front of each record so that you can print a report from the selected records by pressing a command button.

jimbrooking
06-10-2001, 05:30 AM
OK, OK - sending it to you by email.

deepbreath
06-11-2001, 09:31 AM
thanks for all your help cheers