Auto fill

G

Guest

I have a product details table. If I key in the part number field, I would
like to automatically populate the description and price field in a form I am
using. How do I do this?
 
J

Jeff Boyce

Lily

If you use a combobox instead of a text field, the user can key in or look
up a part number... or you could have them look up by description, if that's
easier for them to remember.

And if you include the description, price, part number (?and ProductID)
fields in the query that underlies your combobox, you can add the following
to the combobox's AfterUpdate event:

Me.txtDescription = Me.cboProduct.Column(1)
Me.txtPrice = Me.cboProduct.Column(2)

where Column(n) is the n-1 column in the combobox's rowsource (.Column() is
zero-based, start counting at "0").

Your syntax may vary...

By the way, I would suggest that your Description and Price controls are NOT
bound to underlying fields in tables ... there's rarely a good reason to
redundantly store data (you already have it in the ProductDetail table,
right?), and there are many good reasons not to.

--
Regards

Jeff Boyce
Microsoft Office/Access MVP


Microsoft IT Academy Program Mentor
http://microsoftitacademy.com/

Microsoft Registered Partner
https://partner.microsoft.com/
 
G

Guest

Jeff, many thanks for your reply...I'm afraid that I am brand new to access
and am trying to get a project done quickly (12 hours experience with
Access!) - I really didn't understand your reply (although I am sure a more
experienced Access person would know exactly what you meant)!

From briefly looking at Access for Dummies, it seem to be something to do
with Autolookup but having created the relationship between PartNo,
Description and SellPrice, when I come to fill in my data entry form, I type
in the part number and the Description and SellPrice fields below remain
blank!!

I think I am trying the impossible (after only 12 hours on Access)....but
was hoping that someone could explain in child like terms what I have to do
to make this happen.

If this is possible, please let me know. If not, many thanks for your help
anyway.

Regards
Lily
 

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