When Produt id is typed Product description is shown:

G

Guest

I have tree tables: “productosâ€, “salidas†and “entradasâ€, there is a
relation between Product ID of “entradas†and “Product ID†of “productosâ€,
and there is a query based on tables “salidas†and “productos†tables, when a
product is sold, you put the amount in the “salidas†table and the query
automatically discount the amount from “productosâ€.

I made a form, my form is shown in datasheet view because I want to be able
to input 8 products sold at a time, this form is done.

Now the problem:

I want that when you put the Product ID code in one of the cells of the
“Product ID†column of my form (shown in datasheet view), appears the
description of the product (in the “description of the product†column).

It must be pointed that “Product IDâ€, “Description of the productâ€, and
“amount†are columns in the “productos†table and “amount†and “product IDâ€
are columns in my “salidas†table.
Do you have any suggestions???

When Produt id is typed: Product description is shown:
3 Propylene 12X15
67 Propylene 45X25
676 Propylene 70X80
12 Propylene 10X10
34 Propylene 15X15
 
J

JP

There are two ways of doing this:

1. If you give the user a combo or list box to select the product ID
(rather than having them type it in and risk errors), you can put the
product description in a hidden column of the combo/list box. In the
AfterUpdate Event of the combo/list box (not the form), put code that takes
the description in the hidden column of the selected row and stores it in
the "description of the product" column.

2. If users type the product ID directly into the "Product ID" column,
create an After Update Event for the Product ID textbox (note: for the
textbox, not for the form). In the After Update Event, do a DLookup on the
product table (productos) and retrieve the description. The DLookup might
look like this:

me.[description of the product] = dlookup("description", "productos",
"[Product ID] = " & me.[Product ID])

Make sure you test for a null return (meaning that an invalid product ID was
entered).
 
G

Guest

thanks, this was helpfull

pd. in using the combo box oprion, when I put the code in one cell the
number is copied to the other 7 cells. why???

JP said:
There are two ways of doing this:

1. If you give the user a combo or list box to select the product ID
(rather than having them type it in and risk errors), you can put the
product description in a hidden column of the combo/list box. In the
AfterUpdate Event of the combo/list box (not the form), put code that takes
the description in the hidden column of the selected row and stores it in
the "description of the product" column.

2. If users type the product ID directly into the "Product ID" column,
create an After Update Event for the Product ID textbox (note: for the
textbox, not for the form). In the After Update Event, do a DLookup on the
product table (productos) and retrieve the description. The DLookup might
look like this:

me.[description of the product] = dlookup("description", "productos",
"[Product ID] = " & me.[Product ID])

Make sure you test for a null return (meaning that an invalid product ID was
entered).




filo666 said:
I have tree tables: "productos", "salidas" and "entradas", there is a
relation between Product ID of "entradas" and "Product ID" of "productos",
and there is a query based on tables "salidas" and "productos" tables, when a
product is sold, you put the amount in the "salidas" table and the query
automatically discount the amount from "productos".

I made a form, my form is shown in datasheet view because I want to be able
to input 8 products sold at a time, this form is done.

Now the problem:

I want that when you put the Product ID code in one of the cells of the
"Product ID" column of my form (shown in datasheet view), appears the
description of the product (in the "description of the product" column).

It must be pointed that "Product ID", "Description of the product", and
"amount" are columns in the "productos" table and "amount" and "product ID"
are columns in my "salidas" table.
Do you have any suggestions???

When Produt id is typed: Product description is shown:
3 Propylene 12X15
67 Propylene 45X25
676 Propylene 70X80
12 Propylene 10X10
34 Propylene 15X15
 

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