Need Help urgently

accessdummy

Registered User.
Local time
Today, 12:44
Joined
Sep 7, 2003
Messages
44
I have a problem here.

Scenario:
I have an option groups with 5 option buttons. Some option buttons, upon clicking, will enable the disabled textbox for data entry.

However, if say, I click on the first option and I enter data for the 'enabled' textbox but I have a change of mind and I click on the third option which the first 'enabled' textbox will be disabled and the third textbox will be enable for data entry.

Question:
How to ensure that when I click on the third option button, the first textbox values will disappear so as it will not logged into the table??
 
>>>>the first 'enabled' textbox will be disabled <<<<

Just before the code that does this, add a line somthing like this:

Let textbox.value = ""
 
setting the ControlSouce property to vbNullString will disconnect the Control from the underlaying table. If you keep a copy of the ControlSource in the Tag property, it's easy to restore the value inside a loop.

In addition to your other question
Code:
Private Sub Optiongrp1_AfterUpdate()
  Dim i             As Integer

  For i = 1 To 5
    With Me("Text" & i)
      .Enabled = i = Me!Optiongrp1
      If .Enabled Then
        .ControlSource = .Tag
      Else
        .ControlSource = vbNullString
      End If
    End With
  Next i

End Sub

HTH
 

Users who are viewing this thread

Back
Top Bottom