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

F7 Key Stroke To Exit A Load 1

Status
Not open for further replies.

Fage

Programmer
Mar 6, 2009
7
US
Hello,

I Work on a Access Database that I have a few users for. When they run it they need to load a bunch of variables that are loaded silently behind a splash screen. This process can take some time, and it happens every time the Database is opened. I would Really Like to be able to hit F7 or something and cancel the load. Ideally i would no want the users to know of this option. Here is a sample of some of the code. Right now i have a message box that pops up askin if you want to load the variables.

Public Function Init()
On Error GoTo Init_Err:
Dim fsObj As New FileSystemObject
Dim filFolder As Folder
Dim filFolder1 As Folder
Dim strSettingLookedFor As String
Dim strMessage As String
Dim Answer As String
Dim myNote As String

myNote = "Do You Want To Load Variable? (If you select no Subscription Automation cannot be run)"
Answer = MsgBox(myNote, vbQuestion + vbYesNo, "Load Variables")

If Answer = vbNo Then
MsgBox ("Variables Not Loaded: Subsription Automation cannot be run")
GoTo Init_Exit
End If

If Answer = vbYes Then

Set pubRecordsetSource = CurrentDb.OpenRecordset("qrySource_Final")
Set pubRecordsetAccountsAffected = CurrentDb.OpenRecordset("qrySuppliersaffectedbytransfer", dbOpenSnapshot)

strSettingLookedFor = "Key Generator"
pubKeyGeneratorFileLocation = DLookup("KeyGeneratorFileLocation", "SETTINGS")
Set filFolder = fsObj.GetFolder(pubKeyGeneratorFileLocation)

Init = True
End If

Init_Exit:

Exit Function

Init_Err:

Select Case Err.number
Case 94, 53, 76
strMessage = "The following setting has an error. " & vbCrLf & vbCrLf & _
strSettingLookedFor & vbCrLf & vbCrLf & _
"Please correct in the Settings Form"

MsgBox strMessage, vbCritical, "Missing Settings"
LogError Err, "Init", CurrentDb.name, False
Init = False
GoTo Init_Exit
Case Else
LogError Err, "Init", CurrentDb.name, True
End Select
GoTo Init_Exit

End Function

There are more loads in the middle so it can be a pretty slow process. Any one have any idea? Can i put this in a while loop or something?

thanks
-Jeff

 

So, what you really want is to bypass the loading on YOUR version of the db only, right?
Why not just make a separate copy of the front end that does not call the Init function?


Randy
 
access is a pain to update piece by piece so i usually just copy over the active version with my modified versions. Plus i would like the option of using the key stroke at a users desk. The issue is that there are statistics quieries that we like to look at. To look at them you do not need all the variables loaded.
 
Do you use a login screen?
If so, you could code the init function to not run when
you log in under a specified id.


Randy
 
no there is no log in screen, when the data base is opened it goes right the splash screen. I am not the origional programmer, this was developed in 2006, I was hired to update it, there are alot of things I would have done differntly if I was the origional programmer. A log in screen probably would have been one of them. I really want this key stroke abort sort of option if it is obtainable.

 
What about Ctrl-Break ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
that'll work for aborting a quiery but not a VBA sub or function
 
You could Create your own splash screen. Create a form, make it look however you wish. Use the Timer to delay the function. Then in the Keydown you could set whatever key you wish. I would suggest something other than F7. Set the timer for 10 seconds if it take your function that long then a little more won't matter that much.

 
Open the database using ctrl-shift.
Disable the function that you don't want to run.


Randy
 
What version of Access won't let you stop a VBA function with Ctrl-Break?


Randy
 
Thanks bubba that is exactly wat i wanted, worked perfect.

Randy im running 2003, ctrl+Break doesnt work for vbfunctions, i donno what to tell you. It works fine for quieries called in vb functions but not on the function itself.
 

Strange, because it works fine on my copy of Access 2003.


Randy
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top