473,322 Members | 1,522 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Validating a Form's data via calculated field

Hi all,

I have a form people use to enter checking data. One of the fields is
calculated based on finding the difference of two input fields on the form.
Here are the fields:

CheckAmount
AmountApplied
Funds Remaining

FundsRemaining = CheckAmount - AmountApplied

Can I prevent the form from allowing the user to commit the current record,
move on and create a new record until FundsRemaining = 0. If the user
clicks the New Record button, I'd like the form to check the FundsRemaining
field and pop a msgbox up if FundsRemaining <> 0. Any help would be greatly
appreciated!! :-)

Thank you.
Nov 12 '05 #1
3 3672
Certainly, in the BeforeUpdate event, do the calculation and if the result
isn't zero, set Cancel = True before exiting the event procedure. If you
have FundsRemaining as a calculated Control on the Form, of course, you can
just test it. Be sure you requery the calculated Control in the AfterUpdate
event of the CheckAmount or AmountApplied controls.

Larry Linson
Microsoft Access MVP

"Anonymous" <an*******@somewhere.far> wrote in message
news:daa7b.399454$uu5.73774@sccrnsc04...
Hi all,

I have a form people use to enter checking data. One of the fields is
calculated based on finding the difference of two input fields on the form. Here are the fields:

CheckAmount
AmountApplied
Funds Remaining

FundsRemaining = CheckAmount - AmountApplied

Can I prevent the form from allowing the user to commit the current record, move on and create a new record until FundsRemaining = 0. If the user
clicks the New Record button, I'd like the form to check the FundsRemaining field and pop a msgbox up if FundsRemaining <> 0. Any help would be greatly appreciated!! :-)

Thank you.

Nov 12 '05 #2
This works great! However, I have a me.recalc event that takes place when
other fields on the form are filled in (running realtime calculations as
funds are applied).

As a result, I get the msgbox "All Funds have not been applied" each time I
enter info on the form. I only need this message to pop up when the user
tries to move on and add a new record when there are still funds left to
apply.

More detail:

Check Amount Entered $500
Category1 Entered $100
Category2 Entered $200
Category3
FundsApplied Calc'd $300
FundsRemaining Calc'd $200

User should not be able to click "NewRecord" because FundsRemaining <>0.
Problem is I get the msgbox error message I programmed each time I enter
info in one of the categories and tab to the next field.

This is what I programmed:

If FundsRemaining <> 0 Then
Cancel = True
MsgBox "You have not applied all funds yet"
End If
I wonder how I can get around getting the message on each data input?

"Larry Linson" <la**********@ntpcug.org> wrote in message
news:1T*******************@nwrddc02.gnilink.net...
Certainly, in the BeforeUpdate event, do the calculation and if the result
isn't zero, set Cancel = True before exiting the event procedure. If you
have FundsRemaining as a calculated Control on the Form, of course, you can just test it. Be sure you requery the calculated Control in the AfterUpdate event of the CheckAmount or AmountApplied controls.

Larry Linson
Microsoft Access MVP

"Anonymous" <an*******@somewhere.far> wrote in message
news:daa7b.399454$uu5.73774@sccrnsc04...
Hi all,

I have a form people use to enter checking data. One of the fields is
calculated based on finding the difference of two input fields on the

form.
Here are the fields:

CheckAmount
AmountApplied
Funds Remaining

FundsRemaining = CheckAmount - AmountApplied

Can I prevent the form from allowing the user to commit the current

record,
move on and create a new record until FundsRemaining = 0. If the user
clicks the New Record button, I'd like the form to check the

FundsRemaining
field and pop a msgbox up if FundsRemaining <> 0. Any help would be

greatly
appreciated!! :-)

Thank you.


Nov 12 '05 #3

"Anonymous" <an*******@somewhere.far> wrote in message
news:daa7b.399454$uu5.73774@sccrnsc04...
Hi all,

I have a form people use to enter checking data. One of the fields is
calculated based on finding the difference of two input fields on the form. Here are the fields:

CheckAmount
AmountApplied
Funds Remaining

FundsRemaining = CheckAmount - AmountApplied

Can I prevent the form from allowing the user to commit the current record, move on and create a new record until FundsRemaining = 0. If the user
clicks the New Record button, I'd like the form to check the FundsRemaining field and pop a msgbox up if FundsRemaining <> 0. Any help would be greatly appreciated!! :-)

Thank you.


Go to: http://www.mvps.org/access/
Best Regards
Cody Martin, MVP
Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
by: Allen Browne | last post by:
Subform is based on a single-table query that contains a calculated field: Amount: Round(CCur(Nz(*,0)),2) Continuous subform displays this field in a text box named Amount. As user enters new...
2
by: Kevin Myers | last post by:
Hello, Have yet another problem on a form that has me stumped. In a table that I am working with, the values for one of the fields are stored in meters. However the values that are supplied for...
4
by: Apple | last post by:
Can I edit an calculated field in my form if needed. Thank you in advance for your help. Sincerely Apple
17
by: stathis gotsis | last post by:
Hello everyone, I am tying to come up with an elegant way to process some input data that come from a form. When the user hits the 'Submit' button, i want the form to appear again with the...
3
by: kelley.l.turner | last post by:
Hi all, I am very new to MS Access so please bear with me! I have created a simple calculated field in my data entry form, yet when I view my data table or try to generate a report based on...
5
by: James | last post by:
I have a Continuous form in Access 2000. The form contains a date field and the user has requested( demanded nicely) that they want the date field to be yellow if there is no data in the field....
2
by: jcf378 | last post by:
hi all. I have a form which contains a calculated control ("days") that outputs the # of days between two dates (DateDiff command between the fields and ). However, when I click "Filter by...
9
by: Haas C | last post by:
Hi all! Is there anyway I can override a value in a calculated field on a form? For example: I have a form which displays the following fields based on a query: Premium Due field has the...
3
by: Ciara9 | last post by:
I am having problems trying to update a field in a database using a field in a form. I currently have two fields, Today and Tomorrow in a table named Date. The Today field automatically defaults to...
6
by: Steve67 | last post by:
Wonder if I can get someone’s help with a problem I am having on where to place an IF statement in VBE. I have created a form in Access 2003 that has an automatic calculated field. Basically you...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.