A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Validation in text



 
 
Thread Tools Display Modes
  #1  
Old January 15th, 2008, 06:48 AM posted to microsoft.public.access.forms
nick
external usenet poster
 
Posts: 642
Default Validation in text

I am using a text field named "payperiod" in a subform . I want to restrict
data being entered between 1 and 26. I have tried text validation rule 1 or
27 but I am still able to enter any number in that field. Any sugestions to
correct the problem are appreciated.
  #2  
Old January 15th, 2008, 08:19 AM posted to microsoft.public.access.forms
Steve Sanford
external usenet poster
 
Posts: 190
Default Validation in text

Hi Nick,

Just for clarity: tables have fields, forms have controls; controls can be
bound to fields.

So it sounds like you have a text box (control) on a form. If you entered

1 Or 27

in the validation rule property of the text box, you can enter any number
that is less than 27 (like -100).

If you want to limit the entries to 1 to 26 inclusive, use

0 and 27


in the validation rule property.


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"Nick" wrote:

I am using a text field named "payperiod" in a subform . I want to restrict
data being entered between 1 and 26. I have tried text validation rule 1 or
27 but I am still able to enter any number in that field. Any sugestions to
correct the problem are appreciated.

  #3  
Old January 15th, 2008, 02:58 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Validation in text

In the Before Update event of the control (not a field) payperiod:

Private Sub payperiod_BeforeUpdate(Cancel As Integer)

If Me.payperiod 1 Or Me.payperiod 26 Then
MsgBox "Pay Period must be between 1 and 26"
Cancel = True
End If
--
Dave Hargis, Microsoft Access MVP


"Nick" wrote:

I am using a text field named "payperiod" in a subform . I want to restrict
data being entered between 1 and 26. I have tried text validation rule 1 or
27 but I am still able to enter any number in that field. Any sugestions to
correct the problem are appreciated.

  #4  
Old January 15th, 2008, 04:16 PM posted to microsoft.public.access.forms
nick
external usenet poster
 
Posts: 642
Default Validation in text

Thanks, works great.

"Steve Sanford" wrote:

Hi Nick,

Just for clarity: tables have fields, forms have controls; controls can be
bound to fields.

So it sounds like you have a text box (control) on a form. If you entered

1 Or 27

in the validation rule property of the text box, you can enter any number
that is less than 27 (like -100).

If you want to limit the entries to 1 to 26 inclusive, use

0 and 27


in the validation rule property.


HTH
--
Steve S
--------------------------------
"Veni, Vidi, Velcro"
(I came; I saw; I stuck around.)


"Nick" wrote:

I am using a text field named "payperiod" in a subform . I want to restrict
data being entered between 1 and 26. I have tried text validation rule 1 or
27 but I am still able to enter any number in that field. Any sugestions to
correct the problem are appreciated.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:31 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.