Trying to create an If steatement thet popoulates aa unbound text box in access form

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • deanamiles86
    New Member
    • Sep 2013
    • 9

    Trying to create an If steatement thet popoulates aa unbound text box in access form

    i have created a If Statement that should update an unbound form with the information from another unbound form depending on what number is entered

    Code:
    Private Sub Form_AfterUpdate()
    If Me.Text6 = 2 Then
    Me.Text11 = "Me.SAPR"
    Else
    Me.Text11 = "Now()"
    End If
    End Sub
    but when i enter the number the field remains blank

    please help
    Last edited by zmbd; Sep 9 '13, 01:08 PM. Reason: [Z{Please use the [CODE/] button to format posted code/html/sql - Please read the FAQ}]
  • Seth Schrock
    Recognized Expert Specialist
    • Dec 2010
    • 2965

    #2
    The first thing that I notice is that you have your code in the form's after update event. This won't trigger until you go to another record which can't happen in an unbound form. Try putting your code in the after update event of the control that you are updating.

    Comment

    • zmbd
      Recognized Expert Moderator Expert
      • Mar 2012
      • 5501

      #3
      second thing is that you have no reference to a different form for a value to return/set. You should also include code to check that the form is open or you will encountere another set of Grimlins.

      Comment

      • deanamiles86
        New Member
        • Sep 2013
        • 9

        #4
        Thanks Seth working now cant believe I missed that!!!

        Comment

        Working...