problem w/ the calculated value to validate...2nd post

  • Thread starter Thread starter tonio p.
  • Start date Start date
T

tonio p.

Hi,

Is there a way to use a calculated value in a validation
rule? I just want to validate the total from the <=1000
value only. if it is more than the 1000 value it should be
validated but i got a wrong output.

Many many many thanks in advance.

Tonio
 
Hi,


In a table validation rule? You can only use fields of the actual
record, and cannot use VBA functions.

You can use a CHECK constraint (Jet 4.0) with ADO and, the checked
expression, the one send as "argument" of the CHECK( ... ) can involve
other records or other tables (but still no VBA function). There is no User
Interface for it, you have to type the SQL statement. As example:

CurrentProject.Connection.Execute "ALTER TABLE tableName ADD CONSTRAINT
noMoreThanFourPlayers CHECK( 4>= (SELECT COUNT(*) FROM tableName As a WHERE
a.TeamID = TeamID)) "

limit the maximum number of records to 4, for a given TeamID, through a
statement involving all the other records of the same table.

That is only available under Jet 4.0, and ADO (that is why I used
CurrentProject.Connection, not CurrentDb ).



Hoping it may help,
Vanderghast, Access MVP
 
Back
Top