Results 1 to 8 of 8
  1. #1
    RonL is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2009
    Location
    NJ
    Posts
    114

    Stuck in table data display - validation error.

    Hello, I'm new to Access 2007, but not to relational concepts and design. I'm learning the Access interface by starting a db project. In setting up a table, I entered a validation test for a field in design view, then went to enter a row of data. When the validation test failed on that field, I realized I hadn't understood the syntax of the test, and I couldn't figure out how to make a valid entry. (ie. syntax was valid code, but I didn't know what it required. Dumb, I know.) I just wanted to cancel the row and go back to design, but I could click almost nowhere else on the screen without getting that error message. The only thing I finally was able to do was delete the whole column (and then redefine it). Couldn't find this in the help facility, so a dumb noob question: how do you escape a validation error message loop? A corollary question: I noticed there was a button for testing a validation expression on the menu bar, but it was not enabled? How do you test before being caught in the validation error loop?



    Many thanks, Ron

    Edit - May as well push my luck and ask this too: What's the proper expression to validate a 10 character string so that the first character is a capital letter and the remaining nine are digits? (I have a mask, but want further refinement..)
    Last edited by RonL; 11-21-2009 at 07:49 AM.

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    Esc (escape) is the key to use to get out of an invalid entry

    To avoid your users having the same perplexing/frustrating experience - I would suggest you put the mask in the form; along with a label giving the format example; rather than rule enforcement at the table level.

  3. #3
    RonL is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2009
    Location
    NJ
    Posts
    114
    Would you believe I awoke in middle of the night remembering I'd even used the word "escape" in my post and hadn't tried the key. Doh!

    Speaking of escape, looks like I need to understand use of brackets in expressions to distinguish symbols from literals.

    I read somewhere if you do data validation at field level, you don't need to worry about changing input routines later on. But yeah, my wife, the user, will appreciate having help in the form. Thanks for the tip!

    I'd looked at early Access years ago, and opted to teach myself some Foxpro. Not an IT person, just find it relaxing, and nice to custom make an app for my work. Now retired, but my wife is starting up a home business from a hobby, so I'm back in the game. This ain't your father's Access, though!

    Thx again. -Ron

  4. #4
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Ron

    I personally do not like input masks or formating, especially at the Table level.

    Try this code in the After Update event of the Control on your Form.

    Code:
    Private Sub txtYourControl_AfterUpdate()
        Me.txtYourControl = UCase(Left(Me.txtYourControl, 1)) & Mid(Me.txtYourControl, 2)
    End Sub

  5. #5
    RonL is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2009
    Location
    NJ
    Posts
    114
    Rainlover, thanks. I'm only 3 days into learning the interface, let alone finishing the tables or setting the relations, not to mention learning visual basic - if that's what that event code is. But I understand what you're suggesting. I'm now contemplating that field - which is to be a unique catalog id - to be completely derived from data in other fields, so I may not need an entry form control at all. Not sure whether one field can be derived from others in the same record, so might need to use a non-editable form control. We'll see.

    Thanks for the suggestion. -RonL

  6. #6
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Not > learning visual basic < More correctly Visual Basic for Applications. There are some differences.

    If you need a Unique ID then use AutoNumber.

  7. #7
    RonL is offline Competent Performer
    Windows XP Access 2007
    Join Date
    Nov 2009
    Location
    NJ
    Posts
    114
    If you need a Unique ID then use AutoNumber.
    I want this field to be a unique character string(Lyymm12345),that last part of which is a substring equivalent of an autoincrementing integer, presumably the primary key, and the first part of which derives from other field entries. Any perils in this? If not, I plan to construct it with functions that read other fields in the same record. I suspect this needs to be done at a point prior to committing addition of the record(s) to table(s) - presumably during entry on the form. I gotta learn what the controller object events are and when/how to use them.

    Thx, Ron

  8. #8
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows XP Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    This may help.

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

Similar Threads

  1. Print custom date for data validation
    By TheFuzzball in forum Database Design
    Replies: 2
    Last Post: 10-26-2009, 06:48 AM
  2. Linked Table Field Validation
    By yuriyl in forum Access
    Replies: 4
    Last Post: 04-20-2009, 01:31 PM
  3. Referencing table data in field validation rule
    By toad848 in forum Database Design
    Replies: 3
    Last Post: 03-19-2009, 07:03 AM
  4. Data Validation - Please help
    By larry S in forum Access
    Replies: 0
    Last Post: 11-16-2008, 10:24 PM
  5. Replies: 3
    Last Post: 10-23-2008, 08:43 AM

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