Results 1 to 8 of 8
  1. #1
    Amigo is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    4

    Paid image visible if balance is zero or invoice amount and paid amount is same

    I have been doing a data base to collect my invoices and enter the payments in full or in small amounts.
    I have a form [frmInvoice] that has fields [InvAmount] for total amount in the invoice, [SumPaid] for total amount paid in the subform, [Balance] that shows total balance amount of [InvAmount]-[SumPaid], and I have inserted a Paid [imgPaid] stamp image in the form.

    I want make the image [imgPaid] visible if the invoice is paid if the [Balance] amount is "0" or the values in [InvAmount] and [SumPaid] are same. If there is no payment made, [SumPaid] and [Balance] fields shows blank.

    I'm not a pro for access but for me Macro Builder is easy to use and I do prefer it for these commands. If not code builder is also fine.
    Please help....

    Thank you

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    put this in the ON CURRENT event of the form, (to run after each record you land on)
    and the AFTERUPDATE of the entry textbox (to run after you enter an amt)

    Code:
    sub InvAmt_afterupdate()
       ShowImg
    end sub
    
    sub form_OnCurrent()
       ShowImg
    end sub
    
    sub ShowImg()
    if IsNull(balance) then
       imgPaid.visible = false
    else
       imgPaid.visible = balance = 0
    endif
    end sub

  3. #3
    andy49's Avatar
    andy49 is offline VIP
    Windows 10 Access 2010 64bit
    Join Date
    Nov 2016
    Location
    London
    Posts
    1,051
    Sounds like an form_current event

    If balance=0 or etc etc then
    imgpaid.visible= true
    Else imgpaid.visible =false
    End if

  4. #4
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    Why do you need an image? Why not just a text box with large font?

    Is the form in Single view? Is the image embedded in an Image control with the Picture property? Or are you using an OLEUnbound control?

    The real trick is figuring out what event to put code into. Probably want to use form Current event and also form BeforeUpdate or textbox AfterUpdate.

    Me.controlname.Visible = Me!Balance = 0

    This will not work nice if form is Continuous or Datasheet because setting the Visible property of the control will be reflected in all records. And I don't think image will show in Datasheet any way. Could have text display conditionally with expression in ControlSource. Or if the image is in an external folder, it can be conditionally displayed with expression in ControlSource property of Image control.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Amigo is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    4
    Thanks.
    I tried that but did not work. I did set the image visibility to "No".

  6. #6
    Amigo is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    4
    [QUOTE=andy49;360127]Sounds like an form_current event

    If balance=0 or etc etc then
    imgpaid.visible= true
    Else imgpaid.visible =false
    End if

    Thanks.
    I tried that but did not work. I did set property of the image visibility to "No".

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    You have to put whatever condition is appropriate in place of 'etc etc' if any is needed.

    And make sure you are using the actual names of your controls.

    There is alternate code in post 4.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Amigo is offline Novice
    Windows 7 64bit Access 2013 64bit
    Join Date
    Jun 2017
    Posts
    4
    This is solved as Andy49 as told but not in the way I wanted. I had to put a text box as June7 told, image didn't work with the codes.

    Thanks for the help.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 2
    Last Post: 11-23-2015, 02:11 PM
  2. dues paid on a month with no future dues paid
    By survivo01 in forum Queries
    Replies: 3
    Last Post: 04-13-2015, 11:36 AM
  3. Post Invoice as Paid Criteria
    By burrina in forum Database Design
    Replies: 1
    Last Post: 12-15-2012, 10:33 PM
  4. Replies: 8
    Last Post: 12-12-2012, 02:39 PM
  5. Mark invoice paid
    By kylebmorris in forum Reports
    Replies: 1
    Last Post: 07-19-2010, 12:39 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums