Results 1 to 8 of 8
  1. #1
    Haleakala17 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    36

    Unhappy Madate Users to enter data in Textbox before proceeding to record on form

    All,

    I am requesting if anyone knows a way (VBA script, etc) to make it mandatory for a user to enter data in a textboxes in a form before proceeding to the next record on a form? I know I am able to do this in the table by selecting the value "Yes" in the Required area in the General Tab but I was wondering if there is a VBA script you can enter it in a form instead.



    On attachment is an Access Database in winzip. In the __Property form, I want to make it madatory for users to enter data in the County Shapefile Gross Acres, Township, Mineral Severance Tract, and Unit name fields before proceeding to a new record. If data is not entered in these textboxes for these field, then a person will not be allowed to go to the next record.

    Thank you for your time.

    Haleakala17
    Attached Files Attached Files

  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    Haleakala17 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    36
    pbaldy,

    Thanks for the website but unfortunately the VB script did not work.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    Since you haven't posted your code and I have no idea what "did not work" means, I don't know what the problem might be.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  5. #5
    Haleakala17 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    36
    Sorry about that, code is below.

    If Len(Me.State & vbNullString) = 0 Then
    MsgBox "You need to fill out State
    Cancel = True
    Me.State.SetFocus
    End If
    End Sub

    I got this code from the website you sent me http://www.baldyweb.com/BeforeUpdate.htm . I changed the control name to State from SomeControl.

  6. #6
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    And how does it not work? The only way it wouldn't is if no changes had been made to an existing record, but a new record couldn't be saved without it.
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  7. #7
    Haleakala17 is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Sep 2012
    Posts
    36
    You are absolutely correct, I had made no changes to an existing record. Thank you very much. I apologize for the confusion.

  8. #8
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,521
    No problemo!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

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

Similar Threads

  1. Replies: 1
    Last Post: 07-16-2012, 02:10 PM
  2. Replies: 3
    Last Post: 06-17-2012, 11:55 AM
  3. Replies: 4
    Last Post: 02-27-2012, 10:29 AM
  4. Replies: 1
    Last Post: 07-05-2011, 11:34 PM
  5. Capture enter key on password textbox
    By sarnata in forum Forms
    Replies: 2
    Last Post: 09-09-2010, 10:41 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