Avatar of NuclearOil
NuclearOil
Flag for United States of America asked on

Page won't Requery

Experts,

I have a simple equations that if a text box equals zero value then the "Closed" check box equals true to show that the order is closed.  My issue is that this only works if the form is closed then re-opened. Say the order is 10 and we ship 5 and I leave the form open and ship the remaining 5 later in the day, the code won't work. Although if I ship 5 in the day close the form then re-open it later in the day the code works. I assume this is some kind of requery or refresh error. I've tried different variations of the requery and refresh without any luck.

Any suggestions on what I'm missing here?

If Me.[Text36] = 0 Then Me.Closed = True
Microsoft Access

Avatar of undefined
Last Comment
Lambert Heenan

8/22/2022 - Mon
MINDSUPERB

Try to put your code in the After Update Event of your Text36 field.

Sincerely,
Ed
NuclearOil

ASKER
The code is attached to a command button. The button also prints the shipper.

No did't work, the code is under a command button too. I don't know if that makes a differece?
MINDSUPERB


Try

If Me.[Text36].Value = 0 Then Me.Closed = True


Ed
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
NuclearOil

ASKER
Nope, I have the format to general number too thinking that was the problem.
MINDSUPERB

I assumed that Text36 is an unbound textbox by which its control source is a formula. Can you post the equation/formula?

Ed
NuclearOil

ASKER
Text36=DisplayQty([Text40])
Text40 is the Quantity minus the total shipped from the subform.
[Quantity]-[ShipRecords subform].Form.Text12

The DisplayQty is a module I wrote to not have the #Error.

Text 40 is
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
Lambert Heenan

If you change the check box's control source to

=[Text36]=0

Then is will change whenever Text36 reaches zero.

This may be of use if the checkbox is only being used to display the closed status. If you also want to store the closed status back to the table then you will need a little code in the form's AfterUpdate event. THis is becuase using the above formula in the Control Source of the checkbox unbinds it from the table.
NuclearOil

ASKER
LambertHeenan,

The code I am using is on a command button when clicked. When the operator pushes the button the computer is supposed to evaluate the results of Text36 and decide to close the check box which is in the table and needs to be stored.I'm confused on changing Text36 to = 0 in the control source?
Andrew_Webster

I just spent some time playing with this, and Lambert's answer is spot on.

Your help has saved me hundreds of hours of internet surfing.
fblack61
ASKER CERTIFIED SOLUTION
Lambert Heenan

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question