Creating temporary fields

A

AlanD

I am displaying records in 'continuous form' format. All fields except 1
come from a table.

The extra field is just being used for control purposes, to validate the
input.

Can I create a temporary field to use, as part of the query?

I've tried using '0 AS controlfield'. This creates controlfield but
assigns the same value to all of the recordset, so changing one changes them
all.

Similarly I tried using an unbound field and changing it via a form event,
but again I'm just getting a single variable for all the recordset.

What's the proper way? (I could just add a junk field to the table and use
it, but it doesn't seem right.)

Thanks for any hints

Alan
 
M

Marshall Barton

AlanD said:
I am displaying records in 'continuous form' format. All fields except 1
come from a table.

The extra field is just being used for control purposes, to validate the
input.

Can I create a temporary field to use, as part of the query?

I've tried using '0 AS controlfield'. This creates controlfield but
assigns the same value to all of the recordset, so changing one changes them
all.

Similarly I tried using an unbound field and changing it via a form event,
but again I'm just getting a single variable for all the recordset.

What's the proper way? (I could just add a junk field to the table and use
it, but it doesn't seem right.)


No, no such thing as an updatable "temporary" field.

If you want to have a value associated with each record in a
table, then it has to be a field in the record (or a field
in another table that has a one to one relationship with the
original table).

I wouldn't call it a junk field, I'd call it a part of the
record's functionality.
 
J

John Vinson

What's the proper way? (I could just add a junk field to the table and use
it, but it doesn't seem right.)

Well, you have an arbitrary number of values, all of which can be
different. They've got to be stored SOMEWHERE! A Query is a dynamic
object, and (in Access) contains only the table fields (or
non-editable calculated fields) that make it up.

Either add the field, or create a second table in a one-to-one
relationship; use the same Primary Key and add this additional field.
Base your Form on a query joining this table by a Left Outer Join so
that you see all the data in your table, and NULL for the new field;
entering data into the new field will create a record for that ID.
 
T

TC

Marshall Barton said:
No, no such thing as an updatable "temporary" field.

Not so! See google message ID:
<1067659397.218969@teuthos>

Not that I would suggest using that technique willy-nilly. But it >does<
work!

Cheers,
TC
 

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