Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can you do record validation in Datasheet view? 1

Status
Not open for further replies.

vpellerito

Technical User
Sep 12, 2006
30
US
Is there a way to code simple validation when viewing a form as a datasheet?
I have Field1 that is Yes/No. I don't want Field2 to allow data entry unless Field1 = Yes.
Code:
If Field1 = "Yes" Then
   Field2.Enabled = True
Else
   Field2.Enabled = False
End if

This code disables all the records for Field2 when I view the form as a datasheet... I don't want that. I want specific records to be enabled/not enabled.

Is this possible in datasheet view?
Thanks,
Vince
 
Have a look at Conditional Formatting.
 
try this
add on form current
Code:
Field2.Enabled=Field1 = "Yes"
 
pwise, I think you may have missed vpellerito's mention of a datasheet?
 
... Which means that any property set for a control will be applied to all records, unless conditional formatting is used. YesNo?
 
The datasheet view won't allow me to validate on one specific record using the code I entered above. The Conditional Format in the menu options doesn't seem to allow me to reformat Field2 based on the value of Field1.

I think I remember more flexibility for Conditional Format using VB but I'll have to look into that.

Thanks,
Vince
 
Of course. Thanks Remou. That was easier than I thought.
Vince
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top