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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Quit Access WITHOUT Saving Record

Status
Not open for further replies.

nivlac

Technical User
May 9, 2001
25
0
0
US
Okay, I've gotten some help with code that kicks out idle users. That part works great. After the designated time, the application tries to quit. However, there are required fields on my data-entry form (always different depending on a series of checkboxes). When the application tries to quit and someone was in the middle of entering a new record, the user (who is nowhere around) gets an error message that they need to complete their record before the db can close. Is there any way to add some code that simply disregards the incomplete record and closes without saving it? Thanks for your help.

nivlac
 
Are you using

DoCmd.Quit

?

Or DoCmd.Close?

DoCmd.Quit should not prompt for user to finish the record. However, if you would like, you could write coding to cancel modifications of the record before exiting.
Roy
aka BanditWk
Las Vegas, NV
roy@cccamerica.org
RLMBandit@aol.com (private)
 
I don't know if this would stop that, but it stops some messages:
DoCmd.SetWarnings False
 
DBEngine.Workspaces(0).Rollback

"Rollback ends the current transaction and restores the databases in the Workspace object to the state they were in when the current transaction began."

Maybe this will help.
 
BanditWk - I'm using application.quit

TrojanRabbit - I'm going to try setting the warnings to false now. Will let you know what happens. Tell me more about the rollback. How would it affect other users in the db, or would it?

nivlac
 
Maybe Rollback won't work. After looking into it, I don't think that's the way to go. You would have to use BeginTrans first. It sounds like Rollback would undo any changes to the db since that command.

I found a couple others that look better.
a) Me.Undo - not sure how well this would work. "If the Undo method is applied to a form, all changes to the current record are lost. "

b) CancelUpdate - this looks best. You can cancel the editing or adding of a record. Code would probably be something like the following:
Dim rst As Recordset
Set rst = Me.CurrentRecord
If rst.EditMode = dbEditInProgress Or rst.EditMode = dbEditAdd Then
rst.CancelUpdate
End If
You can look at CancelUpdate in Help for more info.
 
Okay, well, we now know that DoCmd.SetWarnings = False doesn't work in this instance. Even without the warning, the fields in the data-entry form still require data. Now I'm trying to figure out to apply the CancelUpdate function.

nivlac
 
No luck yet, but I've had another thought. The way it is coded now, after 5 minutes of "idle" time, another form opens telling the user that the app will close in 2 minutes unless they click on the "OK" button. After 2 more minutes, the code runs application.quit. AFTER that line of code is executed, the message box pops up telling me to finish inputting the data. When I click on "OK" on that msg box, the app closes. Is there any code that would theoretically "click OK" on that last msg box? Since the user ususally isn't at his/her desk, I would like something to "click on OK" for them. Am I way out in left field here?
Nivlac
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top