Full Version: Update form control from table...
UtterAccess Forums > Microsoft® Access > Access Forms
opopanax666
Hi everybody,
Near with me: my users use a form to input orders, which are sent to a table "tblOrders". These automatically get the status "New", and a flag (checkbox) whether the order has been printed or not. Administration (me) uses a form (as a switchboard), which contains a subform showing the new orders, their status and print-flag. Under this subform I have a button "Print new orders", which, based on a query, prints only the orders which haven't yet been printed, and then sets the flag to "Printed" through an update query.
This all works great, but I'd like the button "Print new orders" to be disabled (greyed out) when the query for new/unprinted orders is empty.
The coding isn't the problem, I have in fact working code which does exactly what I expect. The problem is that this code is based on the On Timer event, so even when all unprinted orders have been printed, I have to wait for the timer for the button to be disabled. I could decrease the delay for the timer, but I find the whole procedure rather inefficient. I've been experimenting with the whole range of events, but can't find one to suit my needs.
In short, what I would like is that the button is enabled the moment a new order arrives (in the background) in the "tblOrders", and is disabled the moment the new ones are all printed...
Can anybody help me?
bulsatar
You would definitely use the timer, so you have a good start. For this one, I think I would setup another table and this table would hold the last record printed id and that is all. Then I would use the timer to check what the last record is in the main table and if the two id's do not match, the code to enable the button runs else it forces the button to be not enabled. I should run pretty quickly as you are just checking the last record in a table. You would have to add some code to the button to make sure that you change the record in table that holds the last record printed id. If you need some help with the coding let us know <
opopanax666
Okay, I'll go for the timer thingy. As for checking for new orders, I already had a query set up, and using Dcount, it works a charm...
Thanks for the reply
This is a "lo-fi" version of UA. To view the full version with more information, formatting and images, please click here.