Updating Form Field

G

Guest

I am working on a stock control project and need a bit of help with my form
layout.

My underlying "Stock" table has various fields including one field that is
used to accept the stock code from a barcode scanner. On the form that is
bound to this table next to the barcode field I want to have a field that
gives a description of the stock item just scanned in. I have set up a
separate "Description" table that just has the stock code (that the scanner
will read) and the associated stock description. I do not need to record the
stock description in the "Stock" table as it exists in the "Description"
table but what I do want is for the form to display the stock description so
the user can see a description of the stock item being entered.

I can't figure out how to display the stock description after the stock item
has been scanned in.

Thanks for any help
Ian.
 
G

Guest

You can use the After Update evento of the control that is bound to the stock
code field. Use the DLookup function to find the description:
Me.txtDescription = DLookup("[Description]", "Description Table",
"[StockCode = '" & Me.txtStockCode & "'")
The control, field, and table names in the example will need to be changed
to match yours. Also note the above example assumes your Stock Code is a
text field. If it is a numeric field, it should be like this:
Me.txtDescription = DLookup("[Description]", "Description Table",
"[StockCode = " & Me.txtStockCode)
 
G

Guest

That's brilliant, thanks very much indeed.

Ian


Klatuu said:
You can use the After Update evento of the control that is bound to the stock
code field. Use the DLookup function to find the description:
Me.txtDescription = DLookup("[Description]", "Description Table",
"[StockCode = '" & Me.txtStockCode & "'")
The control, field, and table names in the example will need to be changed
to match yours. Also note the above example assumes your Stock Code is a
text field. If it is a numeric field, it should be like this:
Me.txtDescription = DLookup("[Description]", "Description Table",
"[StockCode = " & Me.txtStockCode)

Ian said:
I am working on a stock control project and need a bit of help with my form
layout.

My underlying "Stock" table has various fields including one field that is
used to accept the stock code from a barcode scanner. On the form that is
bound to this table next to the barcode field I want to have a field that
gives a description of the stock item just scanned in. I have set up a
separate "Description" table that just has the stock code (that the scanner
will read) and the associated stock description. I do not need to record the
stock description in the "Stock" table as it exists in the "Description"
table but what I do want is for the form to display the stock description so
the user can see a description of the stock item being entered.

I can't figure out how to display the stock description after the stock item
has been scanned in.

Thanks for any help
Ian.
 

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