Rabu, 22 November 2023

Re: [MSAccessProfessionals] Change Value based on another value

I would probably create a small table of ranges that allow you to easily change the upper and lower range values as well as the return value. Your after update code would then use DLookup() with the CTICOBRACount between the low and high values and return the CTICRUHealth value. I always try avoid hard-coding values. 

Duane

Sent from my mobile

On Nov 22, 2023, at 2:43 PM, Paul Baldy <Pbaldy@gmail.com> wrote:


Something along the lines of:

Me.CTICRUHealth  = IIf(Me.CTICOBRACount > 19, 1, 2)

In the after update event of CTICOBRACount.  It could also be done with an If/Then block, as you prefer. 

Paul


------ Original Message ------
From "Bill Singer" <Bill.Singer@at-group.net>
Date 11/22/2023 10:22:41 AM
Subject [MSAccessProfessionals] Change Value based on another value

I am having a hard time figuring out best way to change the value of 3 fields on a form, based on the initial input in another field.

 

I have a form named         f_PremCollFormSetup

I have a field in that form called     CTICOBRACount

 

When a person enters a value into  CTICOBRACount and if that value is over 19 I want to set/change the value in the fields called  CTICRUHealth  and CTICRUDental to a value of 1

 

And if the value of CTICOBRACount is not over 19 I want to set/change the value to 2.

 

I am having a hard time figuring out where the best place to put this.  I am guessing in the AFTER UPDATE property of the CTICOBRACount field.

 

Do I use iff or If then… 

 

It has been a while since I had to add programming.

 

Thanks for your help.

 

Bill

 

Bill Singer

Bill.Singer@at-group.net

 

 

Tidak ada komentar:

Posting Komentar