T
TJEngel via AccessMonster.com
Sorry for the long-windedness! I am a coding amateur.
I am having a few issues with a combo box and a "Reset" command button.
I have a combo box called "PrimaryIssue", and option 6 in the box is "Other".
I have been trying to set it up so that a text box is only enabled if the
user selects the "Other" option. I have been having limited success with the
following code (which I believe I found on this site somewhere):
Private Sub PrimaryIssue_AfterUpdate()
Dim varItm As Variant
For Each varItm In PrimaryIssue.ItemsSelected
If PrimaryIssue.ItemData(varItm) = 6 Then
Me.Text71.Enabled = True
Else
Me.Text71.Enabled = False
Me.Text71.Value = ""
End If
Next varItm
End Sub
Issues I have with this: 1) When a new form opens, with nothing in the combo
box selected, the "Other" text box is enabled, allowing a user to enter text
and submit it even when no combo box option is selected. 2) If the user
selects ONLY option 6, and then deselects option 6, without selecting another
combo box option, the text box remains enabled and text can be entered.
------------
Also having an issue with a "Reset" button to clear all fields in the form.
I have been using this code to reset the combo box:
Private Sub Command46_Click()
Dim n As Integer
For n = 0 To Me.PrimaryIssue.ListCount - 1
Me.PrimaryIssue.Selected(n) = False
Next n
This is followed by the remaining items on the form being set to .Value = "".
Issues I have with this: 1) After pressing "Reset," the "Other" text box
becomes enabled again, even though there are no combo box options selected.
2) The cursor seems to automatically jump to the combo box. How can I get
the cursor to jump to the first item on the form?
Thanks for any help. The due date on this is coming down to the wire! Hope
I have articulated the problem properly.
-TJ
I am having a few issues with a combo box and a "Reset" command button.
I have a combo box called "PrimaryIssue", and option 6 in the box is "Other".
I have been trying to set it up so that a text box is only enabled if the
user selects the "Other" option. I have been having limited success with the
following code (which I believe I found on this site somewhere):
Private Sub PrimaryIssue_AfterUpdate()
Dim varItm As Variant
For Each varItm In PrimaryIssue.ItemsSelected
If PrimaryIssue.ItemData(varItm) = 6 Then
Me.Text71.Enabled = True
Else
Me.Text71.Enabled = False
Me.Text71.Value = ""
End If
Next varItm
End Sub
Issues I have with this: 1) When a new form opens, with nothing in the combo
box selected, the "Other" text box is enabled, allowing a user to enter text
and submit it even when no combo box option is selected. 2) If the user
selects ONLY option 6, and then deselects option 6, without selecting another
combo box option, the text box remains enabled and text can be entered.
------------
Also having an issue with a "Reset" button to clear all fields in the form.
I have been using this code to reset the combo box:
Private Sub Command46_Click()
Dim n As Integer
For n = 0 To Me.PrimaryIssue.ListCount - 1
Me.PrimaryIssue.Selected(n) = False
Next n
This is followed by the remaining items on the form being set to .Value = "".
Issues I have with this: 1) After pressing "Reset," the "Other" text box
becomes enabled again, even though there are no combo box options selected.
2) The cursor seems to automatically jump to the combo box. How can I get
the cursor to jump to the first item on the form?
Thanks for any help. The due date on this is coming down to the wire! Hope
I have articulated the problem properly.
-TJ