Access how do i create a search box,then use the info to pre fill

S

shedendcfc

How do i create a serch box that finds an account number, then using that
account number auto fill a form with the persons name and address
 
G

golfinray

Put a combo box on your form. Allow the wizard to do that for you and select
account number as the number it looks up. Then right click on the combo to
get properties, go to events, select the afterupdate event and click the
little button out to the right, start the code builder. Type:
Me.Filter = "[account#] = """ & Me.combo# & """"
Me.filteron = true
The combo number will be listed, like combo10 or combo 22
 
K

KenSheridan via AccessMonster.com

It depends what you mean by 'auto fill'. Do you simply want to navigate to a
record in an accounts table, or do you want to show the account holder's name
and address in a form bound to another table? If the latter, do not include
name and address columns (fields) in the other table as that introduces
redundancy; include only the account number as a foreign key referencing the
primary key of the accounts table. Base your form on a query which joins the
other table to the accounts table and include the name and address column
from the accounts table in the columns returned by the query. On the form
bind a combo box to the account number column from the other table and set
its RowSource property to something like this:

SELECT [Account Number] FROM [Accounts] ORDER BY [Account Number];

Then when you select an account number in the combo box the name and address
controls will automatically show the data from the accounts table for the
selected account. If you set the Locked property of the name and address
controls to True (Yes) and their Enabled property to False (No) this will
prevent the user inadvertently editing them.

Ken Sheridan
Stafford, England
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top