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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reject update in field based on value in another?

Status
Not open for further replies.

gusbrunston

Programmer
Feb 27, 2001
1,234
US
Thanks in advance (I've never failed to get the help I need!)
On a form describing the properties a company manages, I have an option box with two option buttons: "Active" and "Inactive". I need to reject making a property "inactive" in the propertyStatus field if there is any value other than zero (0) in the currentBalance field.
And I need to provide a message box to explain to the user why the property can't be made "inactive".
The form is based on a table, tblProperties, and the buttons work correctly, but a user cannot be permitted to inactivate a record if there's money owed to or due from the owner.
Thanks again for all your help.:)
Gus Brunston
 
What you might do is not make the option inactive, but instead put action on it for when it is changed or , hhmmm. I was looking at an option group of my own last night, so I know there is no on click, which would be nice. Wel,, you want to evaluate the button, maybe in the validation rule. If is needs to stay inactive then message box explaining why and set active check = false. Then you control the entire box in your code. I hope this gives you a suggestion.
 
Thanks for your answer, isoperator. Here's what I'm trying to get done; I just don't yet know the VB language:

' active value = 1
' inactive value = 2

if status.field (after update) = 2 then

get current.balance.field

if current.balance.field <> 0 then

status.field = 1
beep
display message box &quot;Current balance
is not 0 (zero).&quot;
end if

end if

' restore focus, make sure status.field = 1, etc.
 
Hi,
I'm still searching for a way to prevent making a record inactive based on the value of one field. When the form is displayed, can I suppress the display of a text box (&quot;make inactive&quot;) if the value of a field (&quot;currentBalance&quot;) is not zero? Maybe this is the way. :)
Gus
 
Well...the way I solved my problem (temporarily)...I created a new form based on a query that selected only the properties that have a zero balance in the journal and are currently described as &quot;Active&quot;. Listing each property, I added a toggle button that toggles between &quot;Active&quot; and &quot;Inactive&quot;. Since only qualifying properties are shown on the form, then unqualified properties (those with money owed or due) cannot be changed. This is not the best way, I'm sure, and when I know how it really should be done, I will post it. s-)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top