AutoFill In

P

Phil

I am having a hard time getting this.
I have a table called tbStyles with two fields a
ProductNumber and ProductDescription field.

I have another table called tbPrices that I have to enter
the ProductNumber and I want the ProductDescrption to
fill in automatically.

I would also like to do this on a form.

I cant make any sense of MS help

Thanks so much
 
B

Bruce M. Thompson

I am having a hard time getting this.
I have a table called tbStyles with two fields a
ProductNumber and ProductDescription field.

I have another table called tbPrices that I have to enter
the ProductNumber and I want the ProductDescrption to
fill in automatically.

I would also like to do this on a form.

You don't want to "store" the product description - simply display it. On your
form, place a combo box (to aid in entering existing product numbers), bound to
your "ProductNumber" field (set its "Control Source" property to the
"ProductNumber" field), containing the list of Product Numbers using the
following "rowsource":

SELECT ProductNumber FROM tbStyles
ORDER BY ProductNumber;

Then you can simply set a textbox next to that combo box and set its "Control
Source" to (watch for line wrap - each of the examples is all on one line):

(If "ProductNumber" is a number)
=DLookup("ProductDescription","tbStyles","ProductNumber=" & Me.ProductNumber)

(If "ProductNumber" is a string)
=DLookup("ProductDescription","tbStyles","ProductNumber=""" & Me.ProductNumber &
"""")
I cant make any sense of MS help

I hear that a lot. <g>
 
P

Phil

I must be really stupid, When I make the form I keep
getting an error message in the form field (after I
switch fron design)that says #name? I even made a new
table. Sorry to keep asking such a dumb question
-----Original Message-----

You don't want to "store" the product description - simply display it. On your
form, place a combo box (to aid in entering existing product numbers), bound to
your "ProductNumber" field (set its "Control Source" property to the
"ProductNumber" field), containing the list of Product Numbers using the
following "rowsource":

SELECT ProductNumber FROM tbStyles
ORDER BY ProductNumber;

Then you can simply set a textbox next to that combo box and set its "Control
Source" to (watch for line wrap - each of the examples is all on one line):

(If "ProductNumber" is a number)
=DLookup
("ProductDescription","tbStyles","ProductNumber=" &
Me.ProductNumber)
(If "ProductNumber" is a string)
=DLookup
("ProductDescription","tbStyles","ProductNumber=""" &
Me.ProductNumber &
 
B

Bruce M. Thompson

I must be really stupid, When I make the form I keep
getting an error message in the form field (after I
switch fron design)that says #name? I even made a new
table. Sorry to keep asking such a dumb question

No problem. Is it the "DLookup()" control that is displaying the #Name? Provide
us a small list of your controls with the following properties:

Name (this is the control's name)
Control Source (this is the field to which the control is bound)

As you can see, there are quite a few of us in the newsgroup that are willing to
help out those who "feel" stupid - the fact that you came here to get help
implies that you aren't.

:)
 

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