Go Back   IceInSpace > Equipment > Software and Computers
Register FAQ Calendar Today's Posts Search

Reply
 
Thread Tools Rate Thread
  #1  
Old 24-07-2012, 08:36 PM
TrevorW
Registered User

TrevorW is offline
 
Join Date: Aug 2006
Location: Western Australia
Posts: 8,277
Access



I have an Access form created in 2007

a person enters an invoice total called invtot

the invoice total is then allocated against 4 cost codes called

A1,a2,a3,a4,

in the form footer I do a calculation tha adds the values of a1,a2 ... progressively after each amount is entered in a1,etc and this is totaled it a field named tota

before existing to a new record I need to check that tota agrees with invtot how do I validate this using VBA code and where would I place the code

Reply With Quote
  #2  
Old 24-07-2012, 09:01 PM
silv's Avatar
silv (Annette)
Registered User

silv is offline
 
Join Date: Apr 2012
Location: Germany 54°N
Posts: 1,110
spacey

maybe this helps as to the basic structure and where to put the code?

regarding the code itself:
I always stole VBA code from Excel Macros:
Create a table and do with it what you described.
Once you're sure about the correct outcome, do it again in a new table while recording the actions into a macro.
The code of the macro can be viewed, afterwards.
You'd have to amend it to follow your form field names etc. But it could give you a rough guide.


Good Luck!
Reply With Quote
  #3  
Old 25-07-2012, 05:10 PM
TrevorW
Registered User

TrevorW is offline
 
Join Date: Aug 2006
Location: Western Australia
Posts: 8,277
Actually worked out much simpler


Private Sub Form_AfterUpdate()
Me.Refresh

If Me.Invoice_Amount <> Me.INVTOT Then MsgBox "Totals don't agree."
Me.Amount1.SetFocus
End Sub
Reply With Quote
Reply

Bookmarks


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +10. The time is now 09:57 PM.

Powered by vBulletin Version 3.8.7 | Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Advertisement
Bintel
Advertisement