Results 1 to 1 of 1
  1. #1
    Join Date
    Mar 2012

    Unanswered: update a textbox control in subform based on combo box selection

    Hi Everyone,

    I have a textbox control (D3Count) in the footer of my subform which is acting as a counter for my combobox (D3) which is also present in my subform. The textbox control adds 1 to its count if the combobox control selected value is '2'. And if a user selects the value '1' in combobox it doesn't add anything. So basically I am counting the number of times value '2' is selected in the combobox by a user, in all the rows of my subform.
    With my code below I can track the number of times '2' is selected in the combobox, however if a user change the value from '2' back to '1' for some reason, the textbox is not updated. E.g if after entering 5 records there were three '2's and two '1's and the user decides to change one of the '2' to '1', then how can I update my textbox count from three to two? Can anyone please guide me how can I do that? Thanks in advance.

    Private Sub D3_AfterUpdate()
    If D3.Value = "2" Then
    Dim curval As Integer
    curval = Me.D3count.Value
    Me.D3count.Value = curval + 1
    End If
    End Sub
    Last edited by malik73; 03-11-12 at 19:18.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts