validation rule error (1 Viewer)

desibasha

Registered User.
Local time
Today, 16:25
Joined
Feb 12, 2004
Messages
27
i have a field named publisher name in which you obviously type in a publisher's name, but for some odd reason it keeps giving me an error "Please enter a value between 1-10!. This error message was a data validation/rule I had created for a group of fields named product risk criteria, product risk weightings, publisher risk criteria, and publisher risk weightings. I have deleted the rule from all of those. And the error does not come in those fields. But for some odd reason keeps appearing when a user tries to input a publisher name in the publisher field. What could be causing this? How is this possible? Any help is greatly appreciated.

Thanks!!!!! :)
 

desibasha

Registered User.
Local time
Today, 16:25
Joined
Feb 12, 2004
Messages
27
i figured it out.
thanks anyways all :)


:) :) :) :) :) :)
desibasha said:
i have a field named publisher name in which you obviously type in a publisher's name, but for some odd reason it keeps giving me an error "Please enter a value between 1-10!. This error message was a data validation/rule I had created for a group of fields named product risk criteria, product risk weightings, publisher risk criteria, and publisher risk weightings. I have deleted the rule from all of those. And the error does not come in those fields. But for some odd reason keeps appearing when a user tries to input a publisher name in the publisher field. What could be causing this? How is this possible? Any help is greatly appreciated.

Thanks!!!!! :)
 

Alvinwhit

Registered User.
Local time
Today, 10:25
Joined
Sep 17, 2012
Messages
13
I am trying a validation rule using VBA for my Date of Birth field, however even if the field is valid I get the msgbox message I put in the code. Plese help. This is the code.

If (DOB.Value < 1912) Or (DOB.Value > 1994) Then
MsgBox ("Date is Invalid, Member May Not Qualify Or A User Error Has Occurred. Please Review")
Cancel = True
End If

Do I have the <, > backwards?
 

boblarson

Smeghead
Local time
Today, 08:25
Joined
Jan 12, 2001
Messages
32,059
I am trying a validation rule using VBA for my Date of Birth field, however even if the field is valid I get the msgbox message I put in the code. Plese help. This is the code.

If (DOB.Value < 1912) Or (DOB.Value > 1994) Then
MsgBox ("Date is Invalid, Member May Not Qualify Or A User Error Has Occurred. Please Review")
Cancel = True
End If

Do I have the <, > backwards?


The corrected version:

Code:
If ([B][COLOR=red]Me![/COLOR][/B]DOB < [B][COLOR=red]#[/COLOR][/B]1912[B][COLOR=red]#[/COLOR][/B]) Or ([B][COLOR=red]Me![/COLOR][/B]DOB > [COLOR=red][B]#[/B][/COLOR]1994[B][COLOR=red]#[/COLOR][/B]) Then
MsgBox ("Date is Invalid, Member May Not Qualify Or A User Error Has Occurred. Please Review")
Cancel = True
End If
 

Alvinwhit

Registered User.
Local time
Today, 10:25
Joined
Sep 17, 2012
Messages
13
I gave it a try and I got a Compile Error Message Expected Expression: With this line highlighted

Private Sub Form_BeforeUpdate(Cancel As Integer)

I'm new at this you, can probably tell it by now.
 
Last edited:

boblarson

Smeghead
Local time
Today, 08:25
Joined
Jan 12, 2001
Messages
32,059
Did you type that in or did Access do that for you? And is there an

End Sub

after that and after any code that might be put in under that event header (meaning the Private Sub Form_BeforeUpdate(Cancel As Integer part)
 

Galaxiom

Super Moderator
Staff member
Local time
Tomorrow, 01:25
Joined
Jan 20, 2009
Messages
12,863
Code:
If ([B][COLOR=red]Me![/COLOR][/B]DOB < [B][COLOR=red]#[/COLOR][/B]1912[B][COLOR=red]#[/COLOR][/B]) Or ([B][COLOR=red]Me![/COLOR][/B]DOB > [COLOR=red][B]#[/B][/COLOR]1994[B][COLOR=red]#[/COLOR][/B]) Then

A year only value isn't a valid date string in A2007 at least.

Try this:
Code:
If (Me!DOB < #1/1/1912#) Or (Me!DOB > #12/31/1994#) Then
 

boblarson

Smeghead
Local time
Today, 08:25
Joined
Jan 12, 2001
Messages
32,059
A year only value isn't a valid date string in A2007 at least.

Try this:
Code:
If (Me!DOB < #1/1/1912#) Or (Me!DOB > #12/31/1994#) Then
oops! I experienced extreme brainfart!

 

Users who are viewing this thread

Top Bottom