autofill

G

Guest

I have a form that I would like to autofill on field if another field meets a
certain criteria. For example: I have several services I perform. That field
is services. Depending on what that service is, the price field changes. Is
there anyway to get the price field to auto fill depending on what I put in
the service field?
JoAnn
 
G

Graham R Seach

JoAnn,

I'd suggest creating a new table to store your services and the rates you
charge for them:
tblService
Service (Text, Primary Key)
Rate (Currency)

Then, add a combo box, called cboService, to your form, and set its
RowSource as follows:
SELECT * FROM tblService ORDER BY Service

Bind the combo box to the rate field in the form's underlying table. Set the
combo box's other properties as follows:
ColumnCount: 2
ColumnWidths: 2cm;2cm

Then in the combo box's AfterUpdate event, add the following code to
populate the txtRate textbox:
If Me!txtRate = Me!cboService.Column(1)

Then add the same code to the form's Current event.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
G

Guest

Thanks! I've been trying to figure out how to do that for a long time and
asked everyone I knew. I tried it, and it worked.
 

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