Newbie Question - Searching a database

jkchild

Board Regular
Joined
May 24, 2006
Messages
167
Hi

I have a form where users input data. I would like to add a box whereby a user can search for a particular company.

If possible I would like the user to be able to put the first three letters of a company and another box appears with a list of companies whose name starts with the said three letters, then the user can select the correct company as required.

Is this possible? Can someone advise me please?
Thanks
J
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Hi

Is the selection of the company name using the method you described purely a replacement for manually entering the company name when entering data? In particular, you want to capture the name in the underlying table? If so, then how about creating a combo box in place of your existing text box - this will display a list of all records and as the user starts typing it jumps to the record that matches what has been input so far.

I trust this helps - hopefully I haven't misunderstood your question!

Andrew
 
Upvote 0
Hi Andrew

The method is not purely a replacement for manually adding data. Effectively the search box is to recall data already input.

Thanks
J
 
Upvote 0
Ok Plan - B - Searching a database

Hi

I'm onto plan B as plan A is not getting me anywhere.

I have a form which is where users create new records in a database. (Customer records). On the form I have added a combo box and selected Properties, All. In the Row source line I have added Table/Query, in the Row Source line I have made it point to the customer name in the database.

This seems to work OK, but when I add a new record the combo box list does not automatically add in the new record.

Is there a way to fix this?
Thanks
J
 
Upvote 0
Hi

Add the following code to the 'got focus' event of the combo box :

Code:
Private Sub MyCombo_GotFocus()
    DoCmd.Requery ("MyCombo")
End Sub

Use the actual name of your combo box in place of "MyCombo". Just ask if you aren't sure how to use the code.

HTH, Andrew
 
Upvote 0

Forum statistics

Threads
1,214,819
Messages
6,121,749
Members
449,050
Latest member
excelknuckles

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top