Results 1 to 6 of 6
  1. #1
    Hursan is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    23

    Post New Record, enable disable text boxes based on data enter

    Hi Guys, I hope someone can help me.



    I have a New Sample Entry Form, when the form opens, I need all text boxes, combo box and save button to be disable, but only the first Combo Box (cmbDeIDBase) to be enable. Once a value is enter in a text box or entry selected from the combo box, I need the form to enable the following text box/combo box.

    Step 1) Open New Entry Form. All fields/combo boxes disable but the first ComboBox(cmbDeIDBase).
    Step 2) User selects a value from the first combo box(cmbDeIDBase), then TextBox(txtDeID) is enable.
    Step 3) User types a value in the TextBox(txtDeID), then TextBox(txtSpecimen) is enable.
    Step 4) User types a value in the TextBox(txtSpecimen), then ComboBox(cmbLocation) is enable.
    Step 5) User select a value from the drop down menu on the ComboBox(cmbLocation), then TextBox(txtNote) and SaveAndNext(btmSaveAndNext) button are enable.
    Step 6) User clicks SaveAndNext(btmSaveAndNext) button, record is saved and the form reopens back to step 1.

    ***the txtNote is options, user does not have to enter data on this box**
    thanks in advance

    Click image for larger version. 

Name:	Capture.PNG 
Views:	13 
Size:	19.0 KB 
ID:	43905Enable GingerCannot connect to Ginger Check your internet connection
    or reload the browserDisable in this text fieldEditLog in to edit with GingerLog in to edit with Ginger×

  2. #2
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Are you sure you want to do this, because a user can select a combo value and that can enable the first textbox. Then user can delete the combo value and then what? So there may not be much point given that anyone can undo an entry anywhere in the "stream" of interaction thus basically nullifying the whole constraint. Trying to be so controlling is usually not a good thing. If you want to ensure data integrity, that can be done at any point before the record is saved. If that's not the purpose, then what is it?
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    Hursan is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    23
    Thank you for your message, I see the problem here. there is a reason why we are trying to be very controlling and kind of hard to explain over a message. I want ComboBox(cmbDeIDBase), TextBox(txtDeID), TextBox(txtSpecimen) & ComboBox(cmbLocation) to be mandatory before saving the entry but I can't figure out how to do it, I cannot make those fields mandatory on the table where the data is being store as there will be an admin version of this form where admins can only enter some but not all of the data required on this particular form. any help is greatly appreciated.

    would the following scenario be possible?

    Step 1) Open New Entry Form. All fields/combo boxes disable but the first ComboBox(cmbDeIDBase).
    Step 2) User selects a value from the drop down menu in the first combo box(cmbDeIDBase), then TextBox(txtDeID) is enable.
    Step 3) User types a value in the TextBox(txtDeID), ComboBox(cmbDeIDBase) is disable but keeping the selected value and TextBox(txtSpecimen) is enable.
    Step 4) User types a value in the TextBox(txtSpecimen), TextBox(txtDeID) is disable but keeping entered value and ComboBox(cmbLocation) is enable.
    Step 5) User select a value from the drop down menu on the ComboBox(cmbLocation), TextBox(txtSpecimen) is disable but keeping value entered, TextBox(txtNote) and SaveAndNext(btmSaveAndNext) button are enable.
    Step 6) User clicks SaveAndNext(btmSaveAndNext) button, record is saved and the form reopens back to step 1.

    add two buttons that are always enable, one button gives the user the option to clear the form and start over again at any given point during the data entry, the second button give the user the option to exit the form at any given point during the data entry without saving.

    ***the txtNote is options, user does not have to enter data on this box**Enable GingerCannot connect to Ginger Check your internet connection
    or reload the browserDisable in this text fieldEditLog in to edit with GingerLog in to edit with Ginger× are a unit of surface area equal to 100 square meters More (Definitions, Synonyms, Translation)

  4. #4
    Hursan is offline Novice
    Windows 10 Access 2016
    Join Date
    Jan 2021
    Posts
    23
    Thank you for your message, I see the problem here. there is a reason why we are trying to be very controlling and kind of hard to explain over a message. I want ComboBox(cmbDeIDBase), TextBox(txtDeID), TextBox(txtSpecimen) & ComboBox(cmbLocation) to be mandatory before saving the entry but I can't figure out how to do it, I cannot make those fields mandatory on the table where the data is being store as there will be an admin version of this form where admins can only enter some but not all of the data required on this particular form. any help is greatly appreciated.

    would the following scenario be possible?

    Step 1) Open New Entry Form. All fields/combo boxes disable but the first ComboBox(cmbDeIDBase).
    Step 2) User selects a value from the drop down menu in the first combo box(cmbDeIDBase), then TextBox(txtDeID) is enable.
    Step 3) User types a value in the TextBox(txtDeID), ComboBox(cmbDeIDBase) is disable but keeping the selected value and TextBox(txtSpecimen) is enable.
    Step 4) User types a value in the TextBox(txtSpecimen), TextBox(txtDeID) is disable but keeping entered value and ComboBox(cmbLocation) is enable.
    Step 5) User select a value from the drop down menu on the ComboBox(cmbLocation), TextBox(txtSpecimen) is disable but keeping value entered, TextBox(txtNote) and SaveAndNext(btmSaveAndNext) button are enable.
    Step 6) User clicks SaveAndNext(btmSaveAndNext) button, record is saved and the form reopens back to step 1.

    add two buttons that are always enable, one button gives the user the option to clear the form and start over again at any given point during the data entry, the second button give the user the option to exit the form at any given point during the data entry without saving.

    ***the txtNote is options, user does not have to enter data on this box**Enable GingerCannot connect to Ginger Check your internet connection

    Enable GingerCannot connect to Ginger Check your internet connection
    or reload the browserDisable in this text fieldEditLog in to edit with GingerLog in to edit with Ginger×

  5. #5
    Minty is offline VIP
    Windows 10 Office 365
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    @Micron is suggesting that you would normally use the FORMS before update event to validate data entry, as it fires before the record is saved.

    In it's simplest form you would simply put

    Code:
    If IsNUll(Me.txtSpecimen) Then 
        msgBox "Specimen cannot be blank!",vbInformation,"Missing Data"
        Cancel = True
    End If
    In the event.
    The cancel = true line prevents the record being saved.

    Obviously you need to repeat this for each required control.
    There are ways to simplify this and be more verbose with the code by using tags and control loops, but this is a good starting point.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  6. #6
    Micron is online now Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,737
    Your scenario is possible. I suppose the after update event of one control would disable the prior one. Upon form opening or your undo button click I'd loop through the controls collection and disable all that require it, then simply enable the first one you want enabled. I'd probably use the control tag property to distinguish between those controls and others that you don't want to disable, such as command buttons. Not sure what you mean by "keeping the selected value". Disabling the control would prevent anyone from altering the value. If that means actually saving it, that's a different matter. You could save as you go, but your idea allows for clearing the form to start over on that record, but if you save anything, you now have at least a partial record. If that is a possibility, I'd suggest a staging table that looks like the table that the record will go into in the end. Once the record is to be saved, it is copied to the main table and deleted from the staging table. That way you would not have to worry about identifying the record you want to start over on, because if you move off of that record in the process, it will be a problem.
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

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

Similar Threads

  1. Enable / Disable or Locked Text Boxes
    By aamer in forum Access
    Replies: 5
    Last Post: 12-21-2019, 09:01 PM
  2. Replies: 9
    Last Post: 05-04-2014, 04:26 PM
  3. Replies: 3
    Last Post: 12-02-2012, 09:38 AM
  4. Replies: 1
    Last Post: 02-25-2011, 10:03 AM
  5. Replies: 3
    Last Post: 09-29-2010, 09:31 AM

Tags for this Thread

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