Results 1 to 4 of 4
  1. #1
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672

    Use Form As An Input Box

    I have a form that I am unable to modify the form, but can alter/change VBA - and it has a button that when pressed runs a few update/insert statements and dumps data into Excel. I am in need of a way, and I know an input box can do this, but can you use 1 input box for multiple input, to get 3 inputs from the user before the make table/inserts are performed. I know an input box can capture 1 value at a time and what is most important is code execution freezes, which is what I need.

    Is there a way to on the button press, launch a form with 3 labels, 3 text boxes and 2 buttons (cancel, and ok) -> freeze code execution, if the cancel button is clicked break all code execution here, if the ok button is pressed, verifiy a valid entry was input into all 3 text boxes, if yes, then proceede with the code. If no, throw an error and force valid input into all text boxes before continuing.

  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,902
    Freeze what code execution? The first form procedure that calls the second form? acDialog parameter will suspend code on the first form until the second form closes.

    Yes, I do that. Example:

    Private Sub btnSPG_Click()
    DoCmd.OpenForm "BituminousMixToolsSPG", , , , , acDialog
    Me.Refresh
    End Sub

    Code behind the second form will validate textboxes.
    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
    jo15765's Avatar
    jo15765 is offline Expert
    Windows 10 Access 2013 64bit
    Join Date
    Nov 2010
    Location
    6 Feet Under
    Posts
    672
    What does the Me.Refresh do?

    Sorry - the freeze code execution I was referencing was the insert and update statements. I ONLY want those to run IF all 3 text boxes have been populated AND the ok button was pressed.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,902
    Me.Refresh is refreshing data on the first form because purpose of second form is to add/edit record.

    As I said, code behind second form validates textboxes. Only run INSERT or UPDATE if conditions met. Code in button Click event. Use If Then Else structure.
    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.

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

Similar Threads

  1. Replies: 5
    Last Post: 09-23-2015, 02:29 PM
  2. Replies: 1
    Last Post: 11-04-2014, 12:07 PM
  3. Replies: 6
    Last Post: 10-27-2014, 08:05 PM
  4. Input Forms - How To Input Multiple Fields/Records?
    By butterbescotch in forum Forms
    Replies: 1
    Last Post: 04-04-2013, 06:30 AM
  5. Replies: 1
    Last Post: 11-07-2010, 11:04 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