Validate two fields

  • Thread starter Thread starter easadmin
  • Start date Start date
E

easadmin

I hope this is the correct forum, not sure where to address this
problem as I've tried everything I can think of. Obviously, my
programming skills, understanding of Access or both are lacking.

I have a simple Access 2003 database. The company table has two text
fields, one called Public/Private the other TickerSymbol. I'm trying
to create a rule, that checks for Public in the Public/Private field
and requires the user to enter a ticker symbol if it is Public. The
Public/Private field is populated from a combo box which pulls it's
values from a table. Not sure if that matters.

I've tried placing a validation rule in the form, table fields and
table properties. Some do nothing at all, the others generate a coding
error, despite not generating an error when I create the expression.

Any assistance is greatly appreciated.
 
You need to use the Validation Rule of the table, i.e. the one in the
Properties box, not in the lower pane of table design.

You say the [Public/Private] field reads its data from another table. You
need to look in that field, and see what is actually store there. It may be
a number rather than text.

Let's assume that [Public/Private] is a Number field, and "Public" is 1. The
rule will be something like this:

([Public/Private] Is Null) OR ([Public/Private] <> 1) OR
([TickerSymbol] Is Not Null)
 
It's storing it as text in the Company Table. IOW: The Public/Private
field in the Company table says Public, not a number corresponding to
Public the Public/Private table. I understand what you are saying,
despite my inablility to explain myself clearly. That's what's
confusing me, the fact that it's storing the word Public, which is
what I'm testing for and if the TickerSymbol field is null.

Thanks.



You need to use theValidationRule of the table, i.e. the one in the
Properties box, not in the lower pane of table design.

You say the [Public/Private] field reads its data from another table. You
need to look in that field, and see what is actually store there. It may be
a number rather than text.

Let's assume that [Public/Private] is a Number field, and "Public" is 1. The
rule will be something like this:

([Public/Private] Is Null) OR ([Public/Private] <> 1) OR
([TickerSymbol] Is Not Null)

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips forAccessusers -http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.


I hope this is the correct forum, not sure where to address this
problem as I've tried everything I can think of. Obviously, my
programming skills, understanding ofAccessor both are lacking.
I have a simpleAccess2003 database. The company table has two text
fields, one called Public/Private the other TickerSymbol. I'm trying
to create a rule, that checks for Public in the Public/Private field
and requires the user to enter a ticker symbol if it is Public. The
Public/Private field is populated from a combo box which pulls it's
values from a table. Not sure if that matters.
I've tried placing avalidationrule in the form, table fields and
table properties. Some do nothing at all, the others generate a coding
error, despite not generating an error when I create the expression.
Any assistance is greatly appreciated.
 
In that case, replace the:
1
with:
"Public"
including the quotes.

--
Allen Browne - Microsoft MVP. Perth, Western Australia

Reply to group, rather than allenbrowne at mvps dot org.

easadmin said:
It's storing it as text in the Company Table. IOW: The Public/Private
field in the Company table says Public, not a number corresponding to
Public the Public/Private table. I understand what you are saying,
despite my inablility to explain myself clearly. That's what's
confusing me, the fact that it's storing the word Public, which is
what I'm testing for and if the TickerSymbol field is null.

Thanks.



You need to use theValidationRule of the table, i.e. the one in the
Properties box, not in the lower pane of table design.

You say the [Public/Private] field reads its data from another table. You
need to look in that field, and see what is actually store there. It may
be
a number rather than text.

Let's assume that [Public/Private] is a Number field, and "Public" is 1.
The
rule will be something like this:

([Public/Private] Is Null) OR ([Public/Private] <> 1) OR
([TickerSymbol] Is Not Null)


I hope this is the correct forum, not sure where to address this
problem as I've tried everything I can think of. Obviously, my
programming skills, understanding ofAccessor both are lacking.
I have a simpleAccess2003 database. The company table has two text
fields, one called Public/Private the other TickerSymbol. I'm trying
to create a rule, that checks for Public in the Public/Private field
and requires the user to enter a ticker symbol if it is Public. The
Public/Private field is populated from a combo box which pulls it's
values from a table. Not sure if that matters.
I've tried placing avalidationrule in the form, table fields and
table properties. Some do nothing at all, the others generate a coding
error, despite not generating an error when I create the expression.
Any assistance is greatly appreciated.
 

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