Help with reference and update controls in a form

M

Mattias

Hi

Having problem and getting very weird results in my effort to apdate a
statuscontrol with a value based on the values in two calculated unbound
controls in a form.
I am not shure of if the reference is right here and also what events I
shall use to run the code...

If Me!DueAmount = 0 Then Me!Status = 13
If Me!Total > Me!DueAmount Then Me!Status = 12
Me.Refresh

Thank you in advance

Mattias
 
M

Mattias

Hi

Thanks for replying..

Status is a bound bound control...if possible to update it in the form??
How?

Mattias
 
W

Wayne Morgan

In that case, I would probably try in the Form's OnCurrent event and the Form's
BeforeUpdate event. The OnCurrent will run every time you change to a different record and
the BeforeUpdate will run if you change values on the form that would cause the 2
calculated controls to change. Is this a multi-user database where other users could be
changing these values?

As stated previously, why are you storing data that can be calculated. You shouldn't need
to do this, just calculate it when you need it. That would remove the problems you are
having here.

In the 2 events mentioned above, the If statement you had in your original post should
work.
 
M

Mattias

Hi

Sorry for this late reply.
Yes it is a multiuser database.
"Total" and "DueAmount" are calculated controls (currency) in the form, and
that is ok!
But "Status" (number) is even linked to a table called tblStatus where i
display the linked text based Statusdescription in the form for the user. I
also use this status as criteria for many other routines in the application.
How will I get the same functionality when using a calculated control or
status instead?

Mattias
 
M

Mattias

Hi

Thank you for your help!

Mattias
Wayne Morgan said:
Ok, it's not just a number that you are storing. This makes more sense.

You should be able to calculate the status everywhere you use it as criteria. IIF
statements will work in query criteria as well. When you display the text description, you
could to a lookup (DLookup) to get the description based on the value of status, this
would then be another calculated control.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top