Results 1 to 5 of 5
  1. #1
    zaza123 is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    19

    I cant set a number between 0-1 for my textbox


    I knw its basic but i cant set my textbox to only allow numbers to be keyed in to be 1 & 0....I need a textbox that only allows Number 0 & 1 to be inputed when any other no are inputed, A message Box will Pop Out And say " Input No From 1 & 0" ....Pls

  2. #2
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209

    I cant set a number between 0-1 for my textbox

    1. Open the Form with the Text Box in Design View.
    2. Select the Text Box
    3. Display it's Property Sheet (F4).
    4. Find the Validation Rule Property and type: >-1 and <=1
    5. In the Validation Text Property type: Valid Values 0 and 1 only
    6. Save the Form and open it in normal view.
    7. Try entering any numeric value other than 0 and 1 to test.

  3. #3
    zaza123 is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    19
    Thx i knw i can change from the validation rule but i need a message box to pop out saying either number 1 or 0....Thats y i wrote a VB code here u can have a look at it...

    Here is the code

    Dim H As Interger
    Private Sub Text20_KeyUp(KeyCode As Integer, Shift As Integer)
    H = 1 And H = 0
    Text20.Text = H
    If Text20.Text Then
    Else
    Text20.Text = ""
    MsgBox ("Numbers from 1 to 0 or just leave blank")
    End If
    End Sub

  4. #4
    apr pillai's Avatar
    apr pillai is offline Competent Performer
    Windows 7 64bit Access 2007
    Join Date
    May 2010
    Location
    Alappuzha, India
    Posts
    209
    The Validation Text Property Value serves the same purpose of a Popup Message. When the value input into the Textbox is not within the Validation Rule whatever you write in the Validation Text will appear as a message box. It can be validated through VBA Code too. It is a matter of preference.

  5. #5
    zaza123 is offline Novice
    Windows XP Access 2007
    Join Date
    Jun 2011
    Posts
    19
    Thx alot man!!!!!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Limiting textbox to number issue
    By GraemeG in forum Programming
    Replies: 3
    Last Post: 03-29-2011, 07:25 AM
  2. Getting #Number ! on addition of 5 textbox
    By Grooz13 in forum Forms
    Replies: 0
    Last Post: 08-18-2010, 07:49 AM
  3. Replies: 2
    Last Post: 08-09-2010, 08:13 AM
  4. Making New Record Number Next Numerical Number
    By jhillbrown in forum Access
    Replies: 1
    Last Post: 03-10-2010, 11:06 AM
  5. Report TextBox printing ID Number, not text
    By ZipDoc in forum Reports
    Replies: 8
    Last Post: 02-01-2010, 12:30 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums