validate or not depending on value in another field

K

Krazy Darcy

I am adding a dataentry form for cataloging costumes to a graphics catalog
database application.

However some fields such as "volumeNumber" and "Pagesize" have
required="yes" in the field properties for the underlying tabe called
"tablecreativeworks".
But costumes, being 3d physical objects made of fabric and other materials
don't have a "volumenumber" value or "pagesize" value.

How can I still validate on dataentry forms for entering paper based
artworks into the system and not validate on dataentry forms for costumes?

The lazy way would be simply to have "costume" as a value for page size, and
do similar for other required fields, but doesn't look good as ther would be
unnecessary fields in the costume dataentry form bloating it beyond the
height of the visable screen.
 
J

Jeanette Cunningham

Depends a bit on how you write your validation code.
I use a particular word in a control's tag property.
If the control's tag has R as the 1st character, this indicates that control
needs a value.
If any control with R as the 1st character of its tag is null, this causes
the before update for the form to cancel and user sees a message about it.

In your case, when the form opens, you can check to see whether the object
is "costume" or "pagesize" etc.
Your code can set the control's tag to R for objects that need validation
and clear the R from the tag for the others.


If you use another validation system, you may have code like this:

Select Case Me.ObjectType
Case "VolumeNumber", "Pagesize"
If IsNull(Me.[ControlName]) Then
MsgBox "You must enter a value for ..., or press Esc to cancel."
End If

Case else
End Select

The above code gives you the ideas, it will need some changes to work in
your forms.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia
 
K

Krazy Darcy

Hi,

Just discovered that when calling up the properties for volumeNumber object
(not lablel) when in the ArtworksDataEntry form, there is two lines on the
properties - "validation rule" and "validation text".
Do these two do validation at the form level?

Jeanette Cunningham said:
Depends a bit on how you write your validation code.
I use a particular word in a control's tag property.
If the control's tag has R as the 1st character, this indicates that control
needs a value.
If any control with R as the 1st character of its tag is null, this causes
the before update for the form to cancel and user sees a message about it.

In your case, when the form opens, you can check to see whether the object
is "costume" or "pagesize" etc.
Your code can set the control's tag to R for objects that need validation
and clear the R from the tag for the others.


If you use another validation system, you may have code like this:

Select Case Me.ObjectType
Case "VolumeNumber", "Pagesize"
If IsNull(Me.[ControlName]) Then
MsgBox "You must enter a value for ..., or press Esc to cancel."
End If

Case else
End Select

The above code gives you the ideas, it will need some changes to work in
your forms.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Krazy Darcy said:
I am adding a dataentry form for cataloging costumes to a graphics catalog
database application.

However some fields such as "volumeNumber" and "Pagesize" have
required="yes" in the field properties for the underlying tabe called
"tablecreativeworks".
But costumes, being 3d physical objects made of fabric and other materials
don't have a "volumenumber" value or "pagesize" value.

How can I still validate on dataentry forms for entering paper based
artworks into the system and not validate on dataentry forms for costumes?

The lazy way would be simply to have "costume" as a value for page size,
and
do similar for other required fields, but doesn't look good as ther would
be
unnecessary fields in the costume dataentry form bloating it beyond the
height of the visable screen.


.
 
J

Jeanette Cunningham

To be honest, I have never used these properties on a form.
The same properties exist for the same field in the table, and these will do
validation at the table level.
Validation code in vba behind the form usually runs before the table
validations kick in.
If you catch the validation errors in the form, then the table validations
don't need to be triggered.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Krazy Darcy said:
Hi,

Just discovered that when calling up the properties for volumeNumber
object
(not lablel) when in the ArtworksDataEntry form, there is two lines on the
properties - "validation rule" and "validation text".
Do these two do validation at the form level?

Jeanette Cunningham said:
Depends a bit on how you write your validation code.
I use a particular word in a control's tag property.
If the control's tag has R as the 1st character, this indicates that
control
needs a value.
If any control with R as the 1st character of its tag is null, this
causes
the before update for the form to cancel and user sees a message about
it.

In your case, when the form opens, you can check to see whether the
object
is "costume" or "pagesize" etc.
Your code can set the control's tag to R for objects that need validation
and clear the R from the tag for the others.


If you use another validation system, you may have code like this:

Select Case Me.ObjectType
Case "VolumeNumber", "Pagesize"
If IsNull(Me.[ControlName]) Then
MsgBox "You must enter a value for ..., or press Esc to cancel."
End If

Case else
End Select

The above code gives you the ideas, it will need some changes to work in
your forms.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

Krazy Darcy said:
I am adding a dataentry form for cataloging costumes to a graphics
catalog
database application.

However some fields such as "volumeNumber" and "Pagesize" have
required="yes" in the field properties for the underlying tabe called
"tablecreativeworks".
But costumes, being 3d physical objects made of fabric and other
materials
don't have a "volumenumber" value or "pagesize" value.

How can I still validate on dataentry forms for entering paper based
artworks into the system and not validate on dataentry forms for
costumes?

The lazy way would be simply to have "costume" as a value for page
size,
and
do similar for other required fields, but doesn't look good as ther
would
be
unnecessary fields in the costume dataentry form bloating it beyond the
height of the visable screen.


.
 
K

Krazy Darcy

Thanks,

I'm going to try to set the object's properties for the individual field's
input boxes on the form rather than at the table level (yes I have backed the
database app up) and see if it still works properly. if it does then ms
access will do the coding "backstage" for me.

Jeanette Cunningham said:
To be honest, I have never used these properties on a form.
The same properties exist for the same field in the table, and these will do
validation at the table level.
Validation code in vba behind the form usually runs before the table
validations kick in.
If you catch the validation errors in the form, then the table validations
don't need to be triggered.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


Krazy Darcy said:
Hi,

Just discovered that when calling up the properties for volumeNumber
object
(not lablel) when in the ArtworksDataEntry form, there is two lines on the
properties - "validation rule" and "validation text".
Do these two do validation at the form level?

Jeanette Cunningham said:
Depends a bit on how you write your validation code.
I use a particular word in a control's tag property.
If the control's tag has R as the 1st character, this indicates that
control
needs a value.
If any control with R as the 1st character of its tag is null, this
causes
the before update for the form to cancel and user sees a message about
it.

In your case, when the form opens, you can check to see whether the
object
is "costume" or "pagesize" etc.
Your code can set the control's tag to R for objects that need validation
and clear the R from the tag for the others.


If you use another validation system, you may have code like this:

Select Case Me.ObjectType
Case "VolumeNumber", "Pagesize"
If IsNull(Me.[ControlName]) Then
MsgBox "You must enter a value for ..., or press Esc to cancel."
End If

Case else
End Select

The above code gives you the ideas, it will need some changes to work in
your forms.


Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

I am adding a dataentry form for cataloging costumes to a graphics
catalog
database application.

However some fields such as "volumeNumber" and "Pagesize" have
required="yes" in the field properties for the underlying tabe called
"tablecreativeworks".
But costumes, being 3d physical objects made of fabric and other
materials
don't have a "volumenumber" value or "pagesize" value.

How can I still validate on dataentry forms for entering paper based
artworks into the system and not validate on dataentry forms for
costumes?

The lazy way would be simply to have "costume" as a value for page
size,
and
do similar for other required fields, but doesn't look good as ther
would
be
unnecessary fields in the costume dataentry form bloating it beyond the
height of the visable screen.


.


.
 

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

Top