Results 1 to 3 of 3
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    Input box

    After a command button is selected on a form, an input box is displayed:



    sOrder = InputBox("Please enter the desired sort order. 1 - Request Number, 2 - Position ID, 3 - Hiring Manager, 4 - Notes.", "Sort Order for Position Control Log")


    I'm using a Select statement with 4 cases.

    If the user enters something other than 1, 2, 3, or 4, the code goes to the error message box. After the user enters through the message, it exits the sub.

    How do I get the input box to be displayed again?

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,931
    Use a loop, something like.

    While sOrder = "?"
    sOrder = InputBox("Please enter the desired sort order. " & vbCRLIF & "1 - Request Number" & vbCrLF & "2 - Position ID" & vbCrLf & "3 - Hiring Manager" & vbCrLF & "4 - Notes", "Sort Order for Position Control Log", "?")
    If sOrder >=1 And sOrder <=4 Then
    'do nothing, entry good
    ElseIf sOrder = "" Then
    'user cancelled
    Exit Sub
    Else
    'invalid entry, try again
    sOrder = "?"
    End If
    Wend
    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.

  3. #3
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Nice code. Thanks!!

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

Similar Threads

  1. Input Forms - How To Input Multiple Fields/Records?
    By butterbescotch in forum Forms
    Replies: 1
    Last Post: 04-04-2013, 06:30 AM
  2. input field
    By mlbwhf in forum Access
    Replies: 8
    Last Post: 10-22-2012, 07:17 AM
  3. How to take a user input
    By iamraja5 in forum Access
    Replies: 1
    Last Post: 05-12-2011, 10:17 AM
  4. input form
    By graciemora in forum Access
    Replies: 4
    Last Post: 06-24-2010, 01:39 AM
  5. Dropdown Input Box?
    By Acilladon in forum Programming
    Replies: 3
    Last Post: 06-09-2010, 07:39 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