A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Database Design
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

trying to pull 2 fields from another table into this table



 
 
Thread Tools Display Modes
  #1  
Old May 18th, 2004, 04:56 PM
E Taylor
external usenet poster
 
Posts: n/a
Default trying to pull 2 fields from another table into this table

I have a database which has multiple tables.

There is a table for products which has various columns
including ProductID, CategoryID, Product_Name and
Product_Description.

There is a table called Inventry Transactions which has
the fields TransactionID, TransactionDate, Product_Name
(from the other table) and a few other coloumns.

I have a form which links to an inventry transactions
table, so when a product leaves our 'store' we record
what is going out etc. On the form, you pull up the
Product_Name field and select the correct item. Some of
the items are very similar and it would be really useful
if the Product_Description field (from the products table)
could be shown on the form (and if necessary the inventry
transactions table), so that when an item is selected,
you see the description. But whilst I know how to add
fields that are tied to the inventry transactions table,
I can't seem to add fields for other tables, or pull this
enty over from the product table to the inventry
transaction table in a manner where the data entered also
shows.
  #2  
Old May 19th, 2004, 02:18 AM
J. Goddard
external usenet poster
 
Posts: n/a
Default trying to pull 2 fields from another table into this table

Hi -

Try using the DLookup function. On your form, add an unbound text
control for the product description. Then you can use the DLookup
function to (re)populate that text box whenever the value in the
Product_Name field changes. You will need a little VBA code attached to
the "After Update" event of the Product_Name field, something like this:

searchstring = "[ProductName] = '" & me![Product_Name] & "'"
Me![ProductDescriptionBox]].Value = DLookup("[ProductDescription]",
"ProductTable", searchstring)

I know, the syntax is tricky!
I use this technique myself and find it very useful.

HTH
John

E Taylor wrote:

I have a database which has multiple tables.

There is a table for products which has various columns
including ProductID, CategoryID, Product_Name and
Product_Description.

There is a table called Inventry Transactions which has
the fields TransactionID, TransactionDate, Product_Name
(from the other table) and a few other coloumns.

I have a form which links to an inventry transactions
table, so when a product leaves our 'store' we record
what is going out etc. On the form, you pull up the
Product_Name field and select the correct item. Some of
the items are very similar and it would be really useful
if the Product_Description field (from the products table)
could be shown on the form (and if necessary the inventry
transactions table), so that when an item is selected,
you see the description. But whilst I know how to add
fields that are tied to the inventry transactions table,
I can't seem to add fields for other tables, or pull this
enty over from the product table to the inventry
transaction table in a manner where the data entered also
shows.


  #3  
Old May 19th, 2004, 10:35 AM
external usenet poster
 
Posts: n/a
Default trying to pull 2 fields from another table into this table

Thanks, I have tried this but can't seem to get it to
work. visual basic is nt showing the phrases as red, so
I think I have the terminology correct, but the field
does not update at all, it remains empty (no errors etc)
as though it is not connected to anything.
Any ideas please.

I forgot to mention I'm in access 2000

-----Original Message-----
Hi -

Try using the DLookup function. On your form, add an

unbound text
control for the product description. Then you can use

the DLookup
function to (re)populate that text box whenever the

value in the
Product_Name field changes. You will need a little VBA

code attached to
the "After Update" event of the Product_Name field,

something like this:

searchstring = "[ProductName] = '" & me!

[Product_Name] & "'"
Me![ProductDescriptionBox]].Value = DLookup

("[ProductDescription]",
"ProductTable", searchstring)

I know, the syntax is tricky!
I use this technique myself and find it very useful.

HTH
John

E Taylor wrote:

I have a database which has multiple tables.

There is a table for products which has various

columns
including ProductID, CategoryID, Product_Name and
Product_Description.

There is a table called Inventry Transactions which

has
the fields TransactionID, TransactionDate,

Product_Name
(from the other table) and a few other coloumns.

I have a form which links to an inventry transactions
table, so when a product leaves our 'store' we record
what is going out etc. On the form, you pull up the
Product_Name field and select the correct item. Some

of
the items are very similar and it would be really

useful
if the Product_Description field (from the products

table)
could be shown on the form (and if necessary the

inventry
transactions table), so that when an item is selected,
you see the description. But whilst I know how to add
fields that are tied to the inventry transactions

table,
I can't seem to add fields for other tables, or pull

this
enty over from the product table to the inventry
transaction table in a manner where the data entered

also
shows.


.

  #4  
Old May 21st, 2004, 06:17 PM
John Vinson
external usenet poster
 
Posts: n/a
Default trying to pull 2 fields from another table into this table

On Wed, 19 May 2004 02:35:18 -0700,
wrote:

Thanks, I have tried this but can't seem to get it to
work. visual basic is nt showing the phrases as red, so
I think I have the terminology correct, but the field
does not update at all, it remains empty (no errors etc)
as though it is not connected to anything.
Any ideas please.


Please post your actual code.

John W. Vinson[MVP]
Come for live chats every Tuesday and Thursday
http://go.compuserve.com/msdevapps?loc=us&access=public
 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 01:54 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.