Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2004
    Posts
    5

    Unanswered: HELP, unbound text box needs to run code

    Ok, I have a text box that is populated by the total on a sub form, then I
    have another text box that is populated by the difference of the total amount
    less the amount from another text box. that all works perfectly. what isn't
    working is I have a label that is suppose to set to visible or invisible
    based on whether the difference is positive or negative.

    the code works great, i set it to run on focus, so when i click on it, works
    like a charm. But what I can't do is get it to run when the text box value
    changes. I tried on change and after update, but that only seems to work if
    I changed the value in the text box, since this is all automated, i need it
    to change on it's own.

    how do i do this?

  2. #2
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    Post your current code.
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

  3. #3
    Join Date
    Jul 2005
    Posts
    144
    Causeidm,
    I dont know if i am making any sense (Newbie) but i have this database i built which
    required button popup when member was expired and it worked like a charm. Below is the code for it if i understand correctly that might help you if you can modify it a little??

    Private Sub EmailAddress_BeforeUpdate(Cancel As Integer)
    Call SetEMailButtons
    End Sub

    And then also the code on the subform

    Private Sub Form_Current()
    If IsNull(Me.MembershipDate) = False And (Me.MemberType.Column(1) = _
    "Yearly" Or Me.MemberType.Column(1) = "Three Year") Then
    If (DateDiff("d", Me.MembershipDate, Now()) > 365 And _
    Me.MemberType.Column(1) = "Yearly") Or (DateDiff("d", _
    Me.MembershipDate, Now()) > 1095 And Me.MemberType.Column(1) = _
    "Three Year") Then
    Me.Status = "Expired"
    Me.Status.FontBold = True
    Me.Status.ForeColor = vbYellow
    Me.Status.BackColor = vbRed
    If IsNull(Me.EmailAddress) = False Then Me.EmailNoticeButton.Visible = True
    Else
    GoTo SetActive
    End If
    Else
    SetActive:
    If Me.NewRecord = False Then Me.Status = "Active"
    Me.Status.FontBold = False
    Me.Status.ForeColor = vbBlack
    Me.Status.BackColor = vbWhite
    Me.EmailNoticeButton.Visible = False
    End If

    ' Enable or disable E-Mail buttons depending upon
    ' whether or not an E-Mail address has been supplied
    ' within the 'EmailAddress' fForm field.
    Call SetEMailButtons

    ' Set the Form fields 'Number of Active Members' and
    ' the 'Number of Expired Member' with the appropriate
    ' count.
    Call CountActiveExpired
    End Sub

    Private Sub MainTabCtrl_Change()
    On Error Resume Next
    DoCmd.RunCommand acCmdSaveRecord
    If Err <> 0 Then Err = 0
    Select Case MainTabCtrl.Value
    Case 0 'Tab 1 (General Information)
    'Put whatever code you want here for when
    'the 1st Tab is selected
    Case 1 'Tab 2 (Children)
    'Put whatever code you want here for when
    'the 2nd Tab is selected
    Case 2 'Tab 3 (Database Details)
    Call CountActiveExpired
    End Select
    End Sub


    I hope it helps!

    Thanks

  4. #4
    Join Date
    Mar 2004
    Posts
    5
    If (Text54 > GrowerIncomingNetWeightHistorical) Then
    Label60.Visible = True
    Else
    Label60.Visible = False
    End If

    once again, the code works great, put it to run on got focus to test it, runs when i click on it, but i want it to run when the value in the text box changes because one of the totals changes.

  5. #5
    Join Date
    Mar 2003
    Location
    The Bottom of The Barrel
    Posts
    6,102
    Provided Answers: 1
    You can't trap programmatic changes in a text box. I think that's what you're trying to do?
    oh yeah... documentation... I have heard of that.

    *** What Do You Want In The MS Access Forum? ***

Posting Permissions

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