Results 1 to 3 of 3
  1. #1
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239

    Textbox - validation rule numbers only - Msgbox

    Hi,

    I have set Format property of Textbox for numbers only. When I enter something else, Access opens Msgbox "Value you entered isn't valid". Is there any non-VBA property to make Custom Msgbox for that?



    I tried with Validation rule >0 property, and entered my own Validation Text, but that doesn't work.

  2. #2
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    You could use a "Before Update" or "On Exit" event, something like was done in the following two links:
    http://www.mrexcel.com/forum/microso...ox1-form1.html
    http://answers.microsoft.com/en-us/o...c17db68?auth=1

  3. #3
    Lukael is offline Competent Performer
    Windows 7 64bit Access 2010 64bit
    Join Date
    Oct 2013
    Posts
    239
    thanks Joe,

    this did the trick :

    Code:
    Private Sub txtNumbersOnly_BeforeUpdate(Cancel As Integer)
    If Me.txtNumberOnly.Text Like "*[!0-9]*" Then
       MsgBox "You can enter only numbers in this field !"
       Cancel = True
    End If
    End Sub
    Last edited by Lukael; 02-12-2016 at 08:48 AM.

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

Similar Threads

  1. Replies: 2
    Last Post: 06-16-2015, 03:52 AM
  2. Validation Rule
    By noob123 in forum Access
    Replies: 1
    Last Post: 12-02-2013, 03:39 PM
  3. Validation Rule
    By lynnmc26 in forum Access
    Replies: 1
    Last Post: 03-05-2012, 11:45 PM
  4. Validation Rule
    By WayneSteenkamp in forum Access
    Replies: 7
    Last Post: 03-01-2012, 04:22 AM
  5. Validation Rule
    By rbiggs in forum Forms
    Replies: 4
    Last Post: 08-23-2011, 05:24 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