Results 1 to 3 of 3
  1. #1
    trolleri is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    43

    Disenabling field AND delete recorded value

    I have a combobox cboQuestion1 with three possible values; 1, 2, 3
    Underneath is three disenabled fields - one for each possible answer.

    Code:
    Private Sub cboQuestion1_AfterUpdate()
    
        If Me.cboQuestion1 = 1 Then
            Me.txtAnswer1Comments.Enabled = True
            Me.txtAnswer2Comments.Enabled = False
            Me.txtAnswer3Comments.Enabled = False
        ElseIf Me.cboQuestion1 = 2 Then
            Me.txtAnswer1Comments.Enabled = False
            Me.txtAnswer2Comments.Enabled = True
            Me.txtAnswer3Comments.Enabled = False
        Else
            Me.txtAnswer1Comments.Enabled = False
            Me.txtAnswer2Comments.Enabled = False
            Me.txtAnswer3Comments.Enabled = True
        End If
    
    
    End Sub
    Is it possible to include an automatic deletion of the recorded value inside a textfield, when that textfield is set to enabled=false ?



    E.g. the user chooses the value 1 for cboQuestion1, and records some text in field txtAnswer1Comments. The user then decides to change the value of cboQuestion1 from 1 to 2, and the previously recorded value of txtAnswer1Comments has to be deleted and the textfield disenabled. Textfield txtAnswer2Comments is enabled now enabled, and textfield txtAnswer3Comments remains unchanged.

    Any suggestions or advice on this?

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows XP Access 2003
    Join Date
    Aug 2013
    Posts
    7,862
    Maybe something lie this...

    Code:
        If Me.cboQuestion1 = 1 Then
            Me.txtAnswer1Comments.Enabled = True
            Me.txtAnswer2Comments.Enabled = False
            Me.txtAnswer2Comments.Value = ""
            Me.txtAnswer3Comments.Enabled = False
        ElseIf Me.cboQuestion1 = 2 Then
            Me.txtAnswer1Comments.Enabled = False
            Me.txtAnswer2Comments.Enabled = True
            Me.txtAnswer3Comments.Enabled = False
            Me.txtAnswer3Comments.Value = ""
        Else
            Me.txtAnswer1Comments.Enabled = False
            Me.txtAnswer1Comments.Value = ""
            Me.txtAnswer2Comments.Enabled = False
            Me.txtAnswer3Comments.Enabled = True
        End If

  3. #3
    trolleri is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jan 2013
    Posts
    43
    Thank you!

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

Similar Threads

  1. Replies: 4
    Last Post: 11-19-2013, 12:56 PM
  2. Form Actions Not being Recorded
    By CementCarver in forum Forms
    Replies: 2
    Last Post: 06-15-2013, 06:24 PM
  3. How to delete certain field within form?
    By latestgood in forum Programming
    Replies: 1
    Last Post: 06-27-2011, 01:56 AM
  4. Can't delete a column (field)
    By jlmnjem in forum Access
    Replies: 2
    Last Post: 09-20-2010, 12:02 PM
  5. Delete all records in a field
    By cotri in forum Forms
    Replies: 6
    Last Post: 01-29-2010, 02:44 PM

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