Results 1 to 8 of 8

Thread: Afterupdate

  1. #1
    Join Date
    Sep 2013
    Posts
    3

    Unanswered: Afterupdate

    Hi Dears,
    I want to to make a field invisible in a form after a combobox update based on the data in the combobox.
    If movement is inward Payable amount and beneficiary name should be invisible and if it's outward receivable amount and applicant name should be invisible

    I made the following code
    Private Sub Movement_AfterUpdate()
    If Movement.Value = "Inward" Then
    Me.Payable_Amount.Visible = False
    Me.Beneficiary_Name.Visible = False
    Me.Receivable_Amount.Visible = True
    Me.Applicant_Name.Visible = True
    Else
    Me.Payable_Amount.Visible = True
    Me.Beneficiary_Name.Visible = True
    Me.Receivable_Amount.Visible = False
    Me.Applicant_Name.Visible = False
    End If
    End Sub

    It works but the problem is the changes (visibility) is applied to all records in the form. How can I solve this?

    Thanks

  2. #2
    Join Date
    Apr 2011
    Posts
    34
    You would need to set a recordsource with a WHERE clause such as
    "SELECT * FROM mytable WHERE payable_amount='" & Me.Movement & "'"

  3. #3
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Sorry, but I have no idea what mariostg is talking about, but assuming that all of your Controls are Bound to Fields in the underlying Table, you simply need to place the same code in the Form_Current event, as well as in the Movement_AfterUpdate event. This will make the formatting Record-appropriate.

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  4. #4
    Join Date
    Sep 2013
    Posts
    3
    Thank you so much Missinglinq
    now it works good

  5. #5
    Join Date
    Sep 2013
    Posts
    3
    thanks for ur effort mariostg

  6. #6
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    Glad we could help!

    Welcome to DB Forums!

    Linq ;0)>
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

  7. #7
    Join Date
    Apr 2011
    Posts
    34
    Apologies I misunderstood the problem. I was still low in coffee at the time.

  8. #8
    Join Date
    Jun 2005
    Location
    Richmond, Virginia USA
    Posts
    2,763
    Provided Answers: 19
    A dangerous condition at any time!
    Hope this helps!

    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

Posting Permissions

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