Results 1 to 5 of 5
  1. #1
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts

    The expression you entered produced the following error: 400

    I have a database that has been in production for several months and suddenly generated the following error message:
    "The expression On Key Press you entered as the event property setting produced the following error: 400"
    That's delightfully cryptic considering there is no error #400 in the list of Access error numbers. The database was created and is being run in Access 2010. The On Key Press was used to capture a carriage return (ASCII 13) because the users didn't want to have to click a button to have their entry evaluated. I know of no other way of evaluating an entry in a text box other than having them click a command button (if someone has a suggestion, it would be welcome!) I also understand that the key press events are sometimes troublesome with Windows 7, but I've had no problems with this database until this week. Has anyone else experienced this type of problem and resolved it? I've suggested re-installing the front-end (the database is split, of course) in case it has become corrupted, but haven't heard back from the user (they are at a remote site). Any other suggestions would be welcome.

  2. #2
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Odeus,

    How about events: Change, Before Update, Lost Focus, Exit?

    You should be able to use one of them to evaluate the contents.

    Example using Lost Focus:
    Code:
    Option Compare Database
    Option Explicit
    
    Private Sub Text4_LostFocus()
        If (Not IsNull(Me.Text4.Value)) And _
           IsNull(Me.Text0.Value) Then
             MsgBox "Field1 is Required", _
                    vbOKOnly + vbCritical, _
                    "Error: Required data missing"
           Me.Text0.SetFocus
        End If
        
    End Sub
    Pressing Enter after entering the date produces the message.
    Odeus.JPG

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  3. #3
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Yes, but...
    There's only one field. No second field to move control to. The form is set up to display an image (a picture stored elsewhere) by entering the name of the form (they actually cut-and-paste the name into the field from another application). When they hit Enter, they want to see the image. That's all the form does. Should be simple, right? I suppose I could set up another field with the sole purpose of giving them somewhere to go when they hit Enter. I'd be concerned that it would confuse them, but I could move focus back to the original control as soon as it's placed on the second control. I'll give that a try.

  4. #4
    Super Moderator RetiredGeek's Avatar
    Join Date
    Mar 2004
    Location
    Manning, South Carolina
    Posts
    9,436
    Thanks
    372
    Thanked 1,457 Times in 1,326 Posts
    Qdeus,

    Ok, how about this:
    Code:
    Option Compare Database
    Option Explicit
    
    Private Sub Text0_BeforeUpdate(Cancel As Integer)
        
        MsgBox Text0.Value & vbCrLf & _
               "Was Pasted into this textbox.", _
               vbOKOnly + vbInformation, _
               "Paste Verification"
               
    End Sub
    Paste & Hit Enter
    Odeus.JPG

    HTH
    May the Forces of good computing be with you!

    RG

    PowerShell & VBA Rule!

    My Systems: Desktop Specs
    Laptop Specs

  5. #5
    Star Lounger
    Join Date
    Jan 2008
    Posts
    51
    Thanks
    0
    Thanked 0 Times in 0 Posts
    That seems to work! Not sure why I didn't consider the before update event in the first place..

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •