• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 555
  • Last Modified:

Access validation Rule

i am trying to put this validation rule in:

([Field1] Is Null) OR ([Field2] Is Not Null)

but i keep getting the error:
"Invalid SQL Syntax - cannot use multiple columns in a column-level CHECK constraint
0
AA321
Asked:
AA321
  • 10
  • 5
2 Solutions
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
Where are you trying to do this?

You cannot reference another Field in a table in a validation rule.

mx
0
 
Surone1Commented:
issnull([field4])
0
 
Surone1Commented:
isnull([field4])
0
Efficient way to get backups off site to Azure

This user guide provides instructions on how to deploy and configure both a StoneFly Scale Out NAS Enterprise Cloud Drive virtual machine and Veeam Cloud Connect in the Microsoft Azure Cloud.

 
AA321Author Commented:
I was putting it in one of my fields validation rule in microsoft access. The field name was "address"

([Field1] Is Null) OR ([Field2] Is Not Null)

So basically i put in the validation rule box:

([address] Is Null) OR ([town] Is Not Null)
0
 
Surone1Commented:
try:
isnull([adress]) or not isnull([town])
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
You cannot reference another Field in a table in a validation rule.

You can use any valid expression, like:

<> 0
> 1000 Or Is Null

>= #1/1/2008# And <#1/1/2009#

or

DLookup("CustomerID", "Customers", "CustomerID = Forms!Customers!CustomerID") Is Null

mx
0
 
Surone1Commented:
?? is my access broken then?
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
huh ?
0
 
Surone1Commented:
it accepted an and statement just now while testing, changed it to or and it stopped working..
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
I didn't say you can't use AND .... you cannot reference other fields in the table.

mx
0
 
Surone1Commented:
this is what i meant
validation.jpg
0
 
Surone1Commented:
i'm not saying it works since  it seems to create undesired behaviour
0
 
Surone1Commented:
never mind access changed the syntax for me..
0
 
Surone1Commented:
make  a new page with just this in it and upload it to the server as a new page, maybe it's helpfull
<?php phpinfo() ?>

Open in new window

0
 
Surone1Commented:
sorry for the mispost
0
 
DatabaseMX (Joe Anderson - Microsoft MVP, Access and Data Platform)Commented:
AA321

Just an FYI ... the Assisted Solution cannot work.

mx
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

  • 10
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now