Lookup field

M

Matthew

I have a autonumber field called "id".

I would like to make a different field in the same record have the same data
as "id" when new records are added.

---------------------------


However, this may not be the best way to go about it. Below is my problem.

I have a lookup on the field with the following query:

SELECT psub.id AS xyz_ID_xyz, pmain.product & Left(woodtype.wood,1) AS Expr1
FROM woodtype INNER JOIN (pmain INNER JOIN psub ON pmain.ID=psub.pmain_ID)
ON woodtype.ID=psub.woodtype_ID;

I display Expr1 in the field.

I would like it to automatically create Expr1 when new records are added.

Matthew
 
J

John Vinson

I have a autonumber field called "id".

I would like to make a different field in the same record have the same data
as "id" when new records are added.

No. It's not at all a good way to do it. Storing data redundantly is
NEVER good design.
I have a lookup on the field with the following query:

SELECT psub.id AS xyz_ID_xyz, pmain.product & Left(woodtype.wood,1) AS Expr1
FROM woodtype INNER JOIN (pmain INNER JOIN psub ON pmain.ID=psub.pmain_ID)
ON woodtype.ID=psub.woodtype_ID;

I display Expr1 in the field.

I would like it to automatically create Expr1 when new records are added.

Then use a Query to view (or for that matter to enter) the data; Expr1
will not be editable but it will be visible and will update when new
data is added.
 
M

Matthew

Can you show me how a query like that would be written? I tried, and
couldn't figure it out.

Matthew
 
J

John Vinson

Can you show me how a query like that would be written? I tried, and
couldn't figure it out.

Well, you DID:

SELECT psub.id AS xyz_ID_xyz, pmain.product & Left(woodtype.wood,1) AS
Expr1
FROM woodtype INNER JOIN (pmain INNER JOIN psub ON
pmain.ID=psub.pmain_ID)
ON woodtype.ID=psub.woodtype_ID;

If pmain.ID is the Primary Key of pmain, and Woodtype.ID is the
Primary Key of Woodtype, this query should be updateable. Expr1 as a
calculated field will not be, but if you select the Wood, Product and
ID fields they all should be.
 
M

Matthew

Thanks, I misunderstood you because I was thinking about something else.

Sorry, and thanks again!

Matthew
 

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