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
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