Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Access Form: Compare Amount on Main form with Subform

Status
Not open for further replies.

rpmel

Technical User
Jan 8, 2009
9
Ok,

Somebody should nail this one fairly fast. I'm kinda new at this and not sure how to go about it. I'm designing my own budgeting database, (a) because I don't like the ones available, and (b) to improve my Access / VBA skills.

I have 2 tables:

TBL_Transhdr
============
Date
Payee
Amount
Description

TBL_Transdtl
============
Category
Amount
Description

Transhdr contains the total value of the transaction. Transdtl allows me to allocate the total spent to a particular category or categories.

I've created a "Cancel" Button on my form to cancel changes, but I would like a "Post" Button, which does the following:

A) Verify that the total amount in Tbl_Transhdr matches the total amount in Tbl_Transdtl (That is, all monies have been allocated to an expense category).

B) If the amounts agree, save the record and move on, or

C) If the amounts do not agree, Display A Messagebox ("Please Check Totals"), and do not save the record - so that I can go back and correct, before clicking post again.

A fairly simple one I'm sure, but I'm too new at VBA to know this one and need some help.....

Cheers,
rpmel
 
You haven't mentioned anything about your form/subform or how your tables are related. Generally you shouldn't store the total in the header, only in the details.

Also, you should not name a field "Date" since Date is a function. Use TransDate or HeaderDate or something that has more meaning.

Duane
Hook'D on Access
MS Access MVP
 
How are ya rpmel . . .

Also your tables don't reveal any [blue]primarykeys[/blue] or [blue]relationships![/blue]

[blue]Your Thoughts? . . .[/blue]

See Ya! . . . . . .

Be sure to see thread181-473997 [blue]Worthy Reading![/blue] [thumbsup2]
Also faq181-2886 [blue]Worthy Reading![/blue] [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top