Enter a Default Value in a Field in a Table

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have a table - tblProperty, with fields:

TradeAccommodation
PrivateAccommodation

I want PrivateAccommodation = 100 - TradeAccommodation

So in the default value for PrivateAccommodation I put:

100-[TradeAccommodation]

but I get the error:

"The database engine does not recognise the field 'TradeAccommodation' in a
validation expression, or the default value in the table 'tblProperty' "

Any ideas?

TIA
James
 
You don't store calculated values in a table. If PrivateAccomodation will
ALWAYS be 100-TradeAccomodation, then you don't need to store both pieces of
data in the table - that is redundant.

Instead, simply store the TradeAccomodation in your table. When you need to
print or display PrivateAccomodation, simply calculate it in your forms,
queries, or reports.
 
Thanks for the reminder Rick - I had come across that before (redundant data
etc...)

BUT, just as a point of interest, can a field in a table be populated in the
way I was trying to or, if not, is the reason for that because it is a forced
control against redundancy?

TFTH
 
No, you can't include a calculation in a table. I believe that it can be
done in an SQL database and is called a "trigger", but not in Access.

--
Rick B



access user said:
Thanks for the reminder Rick - I had come across that before (redundant
data
etc...)

BUT, just as a point of interest, can a field in a table be populated in
the
way I was trying to or, if not, is the reason for that because it is a
forced
control against redundancy?

TFTH

access user said:
I have a table - tblProperty, with fields:

TradeAccommodation
PrivateAccommodation

I want PrivateAccommodation = 100 - TradeAccommodation

So in the default value for PrivateAccommodation I put:

100-[TradeAccommodation]

but I get the error:

"The database engine does not recognise the field 'TradeAccommodation' in
a
validation expression, or the default value in the table 'tblProperty' "

Any ideas?

TIA
James
 
Thanks - I've read about triggers before - seem very useful...
TFTH

Rick B said:
No, you can't include a calculation in a table. I believe that it can be
done in an SQL database and is called a "trigger", but not in Access.

--
Rick B



access user said:
Thanks for the reminder Rick - I had come across that before (redundant
data
etc...)

BUT, just as a point of interest, can a field in a table be populated in
the
way I was trying to or, if not, is the reason for that because it is a
forced
control against redundancy?

TFTH

access user said:
I have a table - tblProperty, with fields:

TradeAccommodation
PrivateAccommodation

I want PrivateAccommodation = 100 - TradeAccommodation

So in the default value for PrivateAccommodation I put:

100-[TradeAccommodation]

but I get the error:

"The database engine does not recognise the field 'TradeAccommodation' in
a
validation expression, or the default value in the table 'tblProperty' "

Any ideas?

TIA
James
 
See John Vinson's response as well - same question:

http://www.microsoft.com/office/com...7617c5-382e-4b35-b5e5-c11d7651058b&sloc=en-us

James

access user said:
Thanks - I've read about triggers before - seem very useful...
TFTH

Rick B said:
No, you can't include a calculation in a table. I believe that it can be
done in an SQL database and is called a "trigger", but not in Access.

--
Rick B



access user said:
Thanks for the reminder Rick - I had come across that before (redundant
data
etc...)

BUT, just as a point of interest, can a field in a table be populated in
the
way I was trying to or, if not, is the reason for that because it is a
forced
control against redundancy?

TFTH

:

I have a table - tblProperty, with fields:

TradeAccommodation
PrivateAccommodation

I want PrivateAccommodation = 100 - TradeAccommodation

So in the default value for PrivateAccommodation I put:

100-[TradeAccommodation]

but I get the error:

"The database engine does not recognise the field 'TradeAccommodation' in
a
validation expression, or the default value in the table 'tblProperty' "

Any ideas?

TIA
James
 

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

Back
Top