However, the Query does not dictate, if it is safe to close down..spikepl said:So? "They are supposed to"
Private Sub Command2_Click()
blockClose = False
DoCmd.OpenQuery "End Shift" [COLOR=Green]', acViewNormal, acReadOnly[/COLOR]
DoCmd.OpenQuery "End Client" [COLOR=Green]', acViewNormal, acEdit[/COLOR]
[COLOR=Blue] DoCmd.Close acQuery, "End Shift"
DoCmd.Close acQuery, "End Client"
DoCmd.Quit[/COLOR]
End Sub
Hello @Rain and @David.. I think what Jgr4ng3 wants is reasonable.. In the past I have had problems with some agents just shutting down the Access application without updating their Work hours.. Basically I had an Agent monitor where agents have to click LogOut button to stamp the logout time (whichc also cleaned up temporary tables).. But if they clicked the Main access button their logout times were not stamped.. So I had to come up with a way to trick them by "Disabling the CLOSE button"; that is the method I have used on the Sample in post #11.. Create a hidden Form, whose OnUnload event will check for the global flag to be set to allow close..
In other words, Close should be performed only via the Button I have designed for them.. Not the application's close.. This point I think might have been messed up somewhere along the posts.. I could understand this only with the post spikepl made..
However, the Query does not dictate, if it is safe to close down..
I might be wrong.. I am just picking up pieces..
Regarding the error Jgr4ng3, I think there is some other error in your VB code or the Query you are trying to run.. Also why are you opening to Edit the Query? Close the Query.. Try a Compile.. and try to isolate the error.. Also just a quick reminder, since you have this Ghost form to handle premature close, delete the code that you have copied from the Microsoft link, which came up with the Run time error..
Code:Private Sub Command2_Click() blockClose = False DoCmd.OpenQuery "End Shift" [COLOR=green]', acViewNormal, acReadOnly[/COLOR] DoCmd.OpenQuery "End Client" [COLOR=green]', acViewNormal, acEdit[/COLOR] [COLOR=blue] DoCmd.Close acQuery, "End Shift"[/COLOR] [COLOR=blue] DoCmd.Close acQuery, "End Client"[/COLOR] [COLOR=blue] DoCmd.Quit[/COLOR] End Sub
I believe that the root cause of all of these problems is that the OP is not using Bound Forms.
Access was not written with Unbound Forms in mind.
99.99% of the time, I would think that something much simpler and with far less code that would do this job better.
If the Forms are really bound there would be no need to RUN any other UPDATE queries to any tables.. All could be done by means of..Thank you for your suggestion, but my forms are bound.
Private Sub Form_Unload(Cancel As Integer)
Me.logOutTime = TimeValue(Now)
End Sub
Thank you for your suggestion, but my forms are bound.
Thank you for your suggestion, but my forms are bound.
I'm using the term very informally, but yes he wants information ABOUT the entry (when it was started/completed), not the information CONTAINED IN the entry itself.David R
I don't understand your reference to Metadata.
Does this fit in with your thinking.
Metadata describes other data. It provides information about a certain item's content. For example, an image may include metadata that describes how large the picture is, the color depth, the image resolution, when the image was created, and other data. A text document's metadata may contain information about how long the document is, who the author is, when the document was written, and a short summary of the document.
So if it does then how does this fit in with the need to create all those queries.
This does matter to me. If the Form has no Record Source then it is not bound.Hence the record source being bound (to the entry table) doesn't actually matter.
There is nothing to clarify. NOWHERE in this thread has he said the forms are unbound. NOWHERE in this thread has he posted code that shows that the entry form is unbound and using code to save the data.This does matter to me. If the Form has no Record Source then it is not bound.
It would be good to get this point clarified. The answer may mean I am wrong in my approach, or it may show otherwise.
Another approach is to scroll through the Records via the Form. If this cannot be done without code then it is not Bound.
There is nothing to clarify. NOWHERE in this thread has he said the forms are unbound. NOWHERE in this thread has he posted code that shows that the entry form is unbound and using code to save the data.
YOU are confused and barking up the wrong tree.
Cheers, I just didn't want the OP to get distracted now that it seems to be working.David R
Thank you for clarifying the situation for me.
Much appreciated.