Page 2 of 2 FirstFirst 12
Results 16 to 20 of 20
  1. #16
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496

    Quote Originally Posted by June7 View Post
    Sorry, didn't realize it was a percent, try:

    PriceTotal = CostPriceExGST + IIf(Me!GSTRegistered = True, CostPriceExGST * GSTPercent, 0)
    Wow yes! Thank you so much - works perfectly. Question before I close this - Why use "Me!"? Also why when you give 0 it doesn't bring the CostPriceExGST to 0 as a result if false? Does the 0 just represent adding a null 0? (I think I've answered the second question)...

  2. #17
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    I should have used the Me qualifier on all the control/field references.

    PriceTotal = CostPriceExGST + IIf(Me!GSTRegistered = True, Me.CostPriceExGST * Me.GSTPercent, 0)

    Me is shorthand alias for name of form the code is behind. The dot will invoke intellisense popup tips.

    Adds 0 if GSTRegistered is not True.
    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.

  3. #18
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Quote Originally Posted by June7 View Post
    I should have used the Me qualifier on all the control/field references.

    PriceTotal = CostPriceExGST + IIf(Me!GSTRegistered = True, Me.CostPriceExGST * Me.GSTPercent, 0)

    Me is shorthand alias for name of form the code is behind. The dot will invoke intellisense popup tips.

    Adds 0 if GSTRegistered is not True.
    Is it important to have "Me!" ....?

    me. I assume is current table and Me! is a different table

  4. #19
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Both qualifiers are referencing the form the code is behind. I use ! (bang) when referencing a field in the form's RecordSource but not bound to a data control. Use . (dot) to invoke intellisense.

    I always give data controls names different from the fields they are bound to, like tbxCostPriceExGST.
    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. #20
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    Ok, Many thanks!

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. Storing a value with associated time
    By rikesh in forum Access
    Replies: 2
    Last Post: 03-26-2013, 07:58 AM
  2. Calculation Field in table vs Query calculation
    By Leonidsg in forum Database Design
    Replies: 18
    Last Post: 02-28-2013, 09:38 PM
  3. entering one value but storing another
    By greatfallz in forum Forms
    Replies: 1
    Last Post: 06-09-2011, 07:23 AM
  4. Help with end balance storing
    By Hulk in forum Database Design
    Replies: 6
    Last Post: 03-24-2011, 04:21 AM
  5. storing and printing on a pdf
    By jlm722 in forum Reports
    Replies: 4
    Last Post: 10-27-2009, 02:48 AM

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