Results 1 to 3 of 3
  1. #1
    Lupson2011 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Aug 2011
    Posts
    68

    VBA Accessi 2007 - creating a calculation field

    Hi all



    I have two fields, one entitle 'HRSGiven', the other 'ClaimedAmount'.

    What I am looking to do is that in the HRSGiven (where the input would be an amount of hours e.g. 2), I want, in the 'after update' event, to perform a calculation in the ClaimedAmount field which multiplies the amount of hours by 25 and places the value in the ClaimedAmount field.

    Is there some simple coding I have missed, I have tried various things, but not worked.

    Any help?

    Marc

  2. #2
    Robeen is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    Mar 2011
    Location
    Tulsa, Oklahoma.
    Posts
    1,596
    Can you post the code that you have tried?
    It sounds to me like what you are trying to do is a very simple thing . . . not sure till I see the code why it is not working for you.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    You can either use
    Code:
    Private Sub HRSGiven_AfterUpdate()
      Me.ClaimedAmount = Me.HRSGiven * 25
    End Sub

    Or, in the Control Source Property for the ClaimedAmount Textbox, use

    =[HRSGiven] * 25

    Both work, but if you will ever need to manually change the amount in ClaimedAmount, you need to use the first option.

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. Creating Tables in Access 2007
    By leighkhonig in forum Access
    Replies: 1
    Last Post: 09-23-2011, 06:34 PM
  2. Calculation field
    By johnny in forum Access
    Replies: 4
    Last Post: 08-10-2011, 06:52 AM
  3. creating Stored Procedure in Access 2007
    By shraddha in forum Access
    Replies: 5
    Last Post: 08-03-2010, 09:43 AM
  4. Creating 2003 mde from 2007
    By essaytee in forum Access
    Replies: 2
    Last Post: 12-01-2009, 08:37 AM
  5. Question about creating a date calculation tool
    By bazillion in forum Programming
    Replies: 0
    Last Post: 01-25-2008, 12:08 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