Tried this any number of ways. Have an electronic tick sheet with 30 controls-Clicking on a control label adds a one to the table, a one becomes visible on the form to provide a visual indicator that the control has been clicked. Click again, one is removed (if wrong label clicked), hit enter to save the record. I want my [Other Enter Comment] control to work the same way conditioned on [Comment] control. When [Other Enter Comment] is clicked, zoombox opens to fill in the [Comment] control. I'd like to add a 1 to [Other Enter Comment] control (to permit a sum) if the zoombox (comment) has a comment.The control label acts as a button, a bit of the underlying field is connected to the label to show the one) Tried this with built-in zoombox as well . Using Access 2003
Code:
Private Sub Form_Load()
Zoombox.Visible = False "Make the textbox invisible on loading the form"
End Sub
----------------------------------------------------------------------------------------------
Private Sub OTHER___ENTER_COMMENT_Click()
Zoombox.Visible = True 'When other enter comment field is clicked, zoombox opens
Zoombox.SetFocus 'Focus changes to zoombox. Since control source of zoombox (is
'set to comment field,(in form properties-zoombox field)
'data is entered in comment field
End Sub
-----------------------------------------------------------------------
Private Sub Zoombox_Click()
OTHER___ENTER_COMMENT.SetFocus 'When Zoombox is clicked, sets focus to Other 'enter comment
If OTHER___ENTER_COMMENT = IsEmpty(Zoombox) Then
OTHER___ENTER_COMMENT = "" 'If zoombox contains no data,
If OTHER___ENTER_COMMENT = Not IsEmpty(Zoombox) Then
OTHER___ENTER_COMMENT = 1
Else
If OTHER___ENTER_COMMENT = IsEmpty(Zoombox) Then
OTHER___ENTER_COMMENT = ""
End If
End If
End If
Zoombox.Visible = False ' Closes Zoombox on click
End Sub
-----------------------------------------------------------------------------------------------------------
Private Sub Zoombox_KeyDown(KeyCode As Integer, Shift As Integer)
If KeyCode = 13 Then 'If enter key is pressed in zoombox,
OTHER___ENTER_COMMENT.SetFocus 'sets focus to Other enter comment
If IsEmpty(Zoombox) Then 'If zoombox contains no data,
OTHER___ENTER_COMMENT = "" ' other enter comment field is left blank
Else 'otherwise
OTHER___ENTER_COMMENT = 1 ' a one is inserted
End If
Zoombox.Visible = False ' closes zoombox
End If
End Sub
Attachments
Last edited: