Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

textbox value upon application close

Status
Not open for further replies.

ptrifile

Technical User
Aug 10, 2004
457
US
I have a database that is used to track peoples time. If someone "starts" work but then accidently closes out Access is there a way to have a text box populated with the current time when the database was closed? The form would be already open in this instance.

Hope that made sense. Thanks for any help.

Paul
 
Did you try to use the Close event procedure of the form ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
PHV - I did, and i received a run-time error. "You can't assign a value to this object". I have figured out a solution that better fits my needs but am still curious about this one.

This is simply a textbox named "end_time" the code i used is the following:

Code:
Private Sub Form_Close()
Me.End_Time.Value = Time
End Sub
 
I moved the code the the unload event of the form and it worked as desired.

Paul
 
Microsoft here states:

When you close a form, the following events occur in this order:
Unload → Deactivate → Close

I would guess in Unload event the Form and all its Controls are destroyed (unloaded) and no longer exist. That’s why you cannot assign the value to a text box that is no longer there.

That’s just my guess here, MS does not state what happens to any objects in Unload, Deactivate, or Close events.


Have fun.

---- Andy
 
Andy said:
I would guess in Unload event the Form and all its Controls are destroyed (unloaded) and no longer exist. That’s why you cannot assign the value to a text box that is no longer there.
More or less, I think; the OnClose event is really just the flip side of the OnOpen event, and as in the OnOpen event, the Recordset is not available, and hence you cannot assign a Value to Field in the Recordset.

The Missinglinq

Richmond, Virginia

The Devil's in the Details!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top