Results 1 to 4 of 4
  1. #1
    cjriebe is offline Novice
    Windows XP Access 2000
    Join Date
    Apr 2014
    Location
    WA
    Posts
    13

    Validate textboxes before more VBA


    I am constantly running into this issue for this code:

    Dim strJulianDate As Long

    'Verify Julian Date is entered
    If Len(strJulianDate) <> 3 Then
    MsgBox "Enter Valid Julian Date", vbOkOnly, "Invalid Entry"
    Forms!Form1!JulianDate.SetFocus
    Exit Sub
    Else
    strJulianDate = Forms!Form1!JulianDate
    End If

    And it keeps giving me the MsgBox even if i have 3 digits entered. Reason I have Exit Sub is that there are more text boxes to validate after this one. If I didn't have it, it'd go through the other text boxes as well. I don't want to run this via the Validation Rule, as sometimes users need to clear the textboxes and the Validation rule prevents this. Any ideas?

  2. #2
    burrina's Avatar
    burrina is offline VIP
    Windows 8 Access 2010 32bit
    Join Date
    Oct 2012
    Location
    Freeport,Texas
    Posts
    1,383
    What is your definition of Julian Date and where are you using this code? Do you have a format in your table or just the form and if so, what is it?

  3. #3
    cjriebe is offline Novice
    Windows XP Access 2000
    Join Date
    Apr 2014
    Location
    WA
    Posts
    13
    Julian Date meaning 001 through 365. There is a validation button, if you will, that runs this code and others. There isn't a table, because the Julian Date and other data being entered is used but once. The format is posted under the textbox, but it won't prevent fat-fingering. I just wanted a quick validation of the boxes before it moves on to the meat and potatoes of my code.

  4. #4
    cjriebe is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Apr 2014
    Location
    WA
    Posts
    13
    Rather than try and screw with more code, taking countless hours from other programming, I'm just going to use the built-in validation tool. If the users don't like it, they can code it themselves. I still appreciated the help. Thanks you.

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

Similar Threads

  1. Validate characters in textbox before more vba
    By Ruegen in forum Programming
    Replies: 29
    Last Post: 02-13-2014, 04:45 PM
  2. Validate a field
    By tweety in forum Forms
    Replies: 19
    Last Post: 03-29-2013, 04:06 PM
  3. validate based on another value
    By subnet11 in forum Programming
    Replies: 3
    Last Post: 06-11-2012, 12:12 AM
  4. How to validate data using MS Access
    By maniii in forum Import/Export Data
    Replies: 2
    Last Post: 09-01-2011, 07:29 AM
  5. Validate on sum of multipule textboxes
    By Deutz in forum Access
    Replies: 4
    Last Post: 06-01-2011, 05:50 PM

Tags for this Thread

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