PC Review


Reply
Thread Tools Rate Thread

Can you put reasonable limits on fields in Access?

 
 
=?Utf-8?B?UXVhbGl0eSBQcm9ibGVtcw==?=
Guest
Posts: n/a
 
      5th Oct 2006
For example if I know the value to be entered into a field should be between
..010 and .100, can you set the field up to not accept a value that is out of
this range?

 
Reply With Quote
 
 
 
 
=?Utf-8?B?S2VuIFNoZXJpZGFu?=
Guest
Posts: n/a
 
      5th Oct 2006
Set the field's ValidationRule property in table design view to:

>=0.010 And <=0.100


Ken Sheridan
Stafford, England

"Quality Problems" wrote:

> For example if I know the value to be entered into a field should be between
> .010 and .100, can you set the field up to not accept a value that is out of
> this range?
>


 
Reply With Quote
 
=?Utf-8?B?UmljdGVy?=
Guest
Posts: n/a
 
      5th Oct 2006
Yes. A very simple example, without error trapping:

Private Sub urFieldname_BeforeUpdate

If Me.urFieldname < .010 or Me.urFieldname > .100 Then
Msgbox "You can't do that, pal."
Else: Exit Sub
End If

End Sub


"Quality Problems" wrote:

> For example if I know the value to be entered into a field should be between
> .010 and .100, can you set the field up to not accept a value that is out of
> this range?
>

 
Reply With Quote
 
Granny Spitz via AccessMonster.com
Guest
Posts: n/a
 
      5th Oct 2006
Quality Problems wrote:
> if I know the value to be entered into a field should be between
> .010 and .100, can you set the field up to not accept a value that is out of
> this range?


Open the table in design view and click on the column you want to restrict.
Place this in the Validation Rule property:

Between 0.01 And 0.1

Place this in the Validation Text property:

The amount must be between 0.01 and 0.1.

--
Message posted via http://www.accessmonster.com

 
Reply With Quote
 
=?Utf-8?B?S2VuIFNoZXJpZGFu?=
Guest
Posts: n/a
 
      5th Oct 2006
You should also set the return value of the Cancel argument to True if the
criteria are not met when validating at control level in the BeforeUpdate
event procedure.

Ken Sheridan
Stafford, England

"Ricter" wrote:

> Yes. A very simple example, without error trapping:
>
> Private Sub urFieldname_BeforeUpdate
>
> If Me.urFieldname < .010 or Me.urFieldname > .100 Then
> Msgbox "You can't do that, pal."
> Else: Exit Sub
> End If
>
> End Sub
>
>
> "Quality Problems" wrote:
>
> > For example if I know the value to be entered into a field should be between
> > .010 and .100, can you set the field up to not accept a value that is out of
> > this range?
> >

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I set size limits on form fields? tevans1947 Microsoft Word Document Management 2 22nd Feb 2010 06:28 PM
What are limits on custom fields (how many, etc.) in BCM ? WestCoastFan Microsoft Outlook BCM 1 1st Sep 2008 05:59 PM
Limits on OR conditions in calculated fields? TA Bran via AccessMonster.com Microsoft Access Queries 2 3rd Feb 2005 03:37 PM
Setting axis limits by reference to fields Geoff Microsoft Excel Charting 2 5th Nov 2003 05:57 PM
Character limits in drop down fields? - Word 2002 Mary Ann Garavaglia Microsoft Word Document Management 1 12th Sep 2003 09:55 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 10:00 PM.