Results 1 to 5 of 5
  1. #1
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199

    how to require all fields be input before pressing submit button?


    Hello,

    Is there a way to require all fields which I've put on a form be required before the user is able to submit (using the enter record button I created)?

    Thanks,

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,549
    If IsValidForm() then 'do stuff


    Code:
    public Function IsValidForm() as boolean
    dim vMsg
      select case true
           case txtName = "" 
              vMsg = "Client Name is missing"
           case isnull(cboState )
              vMsg = "State is missing"
       cboState.setfocus
      end select
      if vMsg <>"" then msgbox vmsg,vbCritical,"Required"
      IsValidForm =vMsg =""
    end sub

  3. #3
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,646
    Or maybe set the fields as required in the table and let Access nag users.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  4. #4
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    Thanks June7, that' s a simple solution. I'll try playing around the the VBA script as well, thanks for that ranman.

  5. #5
    accessmatt is offline Competent Performer
    Windows 7 32bit Access 2010 32bit
    Join Date
    Aug 2011
    Posts
    199
    June7, do you know if there's a way to change the error text when I use set required. Meaning it says I must enter a value in MYTABLE.MYFIELD field. Is there a way I can make that user friendly like you must enter a value in the XYZ field?

    Thanks,

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

Similar Threads

  1. require input in a field when condition met
    By edwardcga in forum Forms
    Replies: 12
    Last Post: 11-01-2013, 10:36 AM
  2. Input Mask to Require First and Last names
    By justair07 in forum Access
    Replies: 4
    Last Post: 08-20-2013, 06:11 AM
  3. Replies: 1
    Last Post: 09-13-2010, 01:57 PM
  4. Help Require (Macro Save button )?????
    By aligahk06 in forum Access
    Replies: 1
    Last Post: 04-18-2010, 08:38 AM
  5. Replies: 6
    Last Post: 02-09-2010, 07:53 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