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!

if statement (proceed/nothing)

Status
Not open for further replies.

wshs

Programmer
Nov 22, 2005
220
US
how do i build an if statement that does nothing if it's true. ie.

If Forms!frm_projectbud!ProjectAmt > Forms!frm_projectbud!txtProjBudTotal Then (nothing... proceed action?)

else
MsgBox "Project Budget Total can not exceed your Balance"
End If

ALSO how can i build a filter to make sure the sum of a field in subform does not exceed certain amount?

ie. form /w subform. Form has fieldbox "txtAmount"
users can fill out subforms. however, i need to somehow figure out a way so that sum of their "txtBudamt" can't exceed txtAmount.

pretty much. user has given amount. And they can divide/categorize the fund.

i'ved tried creating a text box to sum the budamt and use the above if statement but does not work... any suggestions?
 
Why not inverting the test or using the Not operator ?
One way:
If Forms!frm_projectbud!ProjectAmt <= Forms!frm_projectbud!txtProjBudTotal Then
MsgBox "Project Budget Total can not exceed your Balance"
End If
Another way:
If Not (Forms!frm_projectbud!ProjectAmt > Forms!frm_projectbud!txtProjBudTotal) Then
MsgBox "Project Budget Total can not exceed your Balance"
End If

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
i've tried it in beforeupdate event of projectamt..
and it doesnt work..
 
it doesnt work
Well, you really want someone help you ?
What happens ? Error message ? Unexpected behaviour ? ...
What do you want to do ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top