Solved

Page won't Requery

Posted on 2011-03-08
10
276 Views
Last Modified: 2012-05-11
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
0
Comment
Question by:NuclearOil
  • 4
  • 3
  • 2
  • +1
10 Comments
 
LVL 19

Expert Comment

by:MINDSUPERB
Comment Utility
Try to put your code in the After Update Event of your Text36 field.

Sincerely,
Ed
0
 

Author Comment

by:NuclearOil
Comment Utility
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?
0
 
LVL 19

Expert Comment

by:MINDSUPERB
Comment Utility

Try

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


Ed
0
 

Author Comment

by:NuclearOil
Comment Utility
Nope, I have the format to general number too thinking that was the problem.
0
 
LVL 19

Expert Comment

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

Ed
0
Complete Microsoft Windows PC® & Mac Backup

Backup and recovery solutions to protect all your PCs & Mac– on-premises or in remote locations. Acronis backs up entire PC or Mac with patented reliable disk imaging technology and you will be able to restore workstations to a new, dissimilar hardware in minutes.

 

Author Comment

by:NuclearOil
Comment Utility
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
0
 
LVL 11

Expert Comment

by:LambertHeenan
Comment Utility
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.
0
 

Author Comment

by:NuclearOil
Comment Utility
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?
0
 
LVL 8

Expert Comment

by:Andrew_Webster
Comment Utility
I just spent some time playing with this, and Lambert's answer is spot on.

0
 
LVL 11

Accepted Solution

by:
LambertHeenan earned 500 total points
Comment Utility
If you display the properties of the check box, on the Data tab you will see the "Control Source" listed. If you enter the following in the property

=[Test36]=0

Then you should get the desired results.
0

Featured Post

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
In the previous article, Using a Critera Form to Filter Records (http://www.experts-exchange.com/A_6069.html), the form was basically a data container storing user input, which queries and other database objects could read. The form had to remain op…
Using Microsoft Access, learn some simple rules for how to construct tables in a relational database. Split up all multi-value fields into single values: Split up fields that belong to other things into separate tables: Make sure that all record…
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now