Access Validation Rule and Field Names

Access Validation Rule and Field Names

Post by Angela Shakespear » Sat, 12 Jan 2002 05:19:30

I am trying to place a validation rule in a field that, if
it is correct, should implement a field that is in the
table.  For example, Unit Cost is a field in the table.
The validation I am trying to place is in
field "Materials" rule: if [Item Code]=x, [Unit Cost]
Meaning, place the unit cost in the materials field if the
item code it x.  However, Invalid SQL syntax cannot use
multiple columns in a column level check constraint
message pops up.

It says that I cannot use a field within a field?  So how
do I separate cost into two categories on the same receipt?

Additional, the field names were pre-established and they
have spaces in them, will this cause an error?  


1. Evaluating a field containing a field name

Here's the ugly simplified example (i've removed all the joins, extra when
conditions and other fields that behave similarly).
I have a field PROFLD which contains the name of the field that has the
value I need (ie. PROFLD is char $6. and PFT_* are all numeric 10.2).
Can this example be replaced by some non-hard-coded one-liner like
PROFIT = ???(????(PROFLD),'10.2') ? I couldn't find the combination of
functions that would do the job.

proc SQL;
  create table x as
  select, PRODUCT,
        when (PROFLD = 'PFT_A') then PFT_A
        when (PROFLD = 'PFT_B') then PFT_B
        when (PROFLD = 'PFT_C') then PFT_C
        when (PROFLD = 'PFT_D') then PFT_D
        else 0
  end as PROFIT
  from x;

Tired of spam? Get advanced junk mail protection with MSN 8.

2. Winter Wonderland..

3. import with field names because fields wrong order

4. Where's my SunSPARC?!

5. How do I extract ONE particular field, when multiple table contain the same field name?

6. POP3 v. SMTP

7. get source table.field name from view's field

8. Address Book file

9. how to get the source table & field name of a view field

10. Validation Rules

11. Why same error msg from column validation rule display twice ?

12. PB repertory Validation rules problems

13. datawindow validation rule - help me!