Hi all,
I inherited quite a few databases at my new job, and my predecessor had set up some VBA on a couple of databases so that if the user tries to open the Access file from the shared server, it will force quit on them. However, he didn't leave any descriptive notes in his code so I'm not 100% sure that this is all the code I need to do this:
Option Compare Database
Option Explicit
Sub ValidateCDrive()
If Not CurrentDb.Name Like "C:\*" Then
MsgBox ("The file must be located on your C:\ drive.")
DoCmd.Quit
End If
End Sub
***Then in another module that opens a particular form, it does the following code upon load***
Private Sub Form_Load()
Me.TimerInterval = Nz(DLookup("TimerInterval", "tblForms", "FormName = '" & Me.Name & "'"), 0) * 1000
Debug.Print Me.TimerInterval
ValidateCDrive
InitializeUser
ResetForm
End Sub
****
I think where I'm a little confused is why this subroutine is called on a particular form's code, when this validation code runs wright when you open the database. The form module that it is called from does not open automatically when opening the database.
Additionally, I am wondering what the translation of the Me.TimerInterval is so if anybody could tell me what that does exactly, that would be awesome!
Thanks
Nicole
I inherited quite a few databases at my new job, and my predecessor had set up some VBA on a couple of databases so that if the user tries to open the Access file from the shared server, it will force quit on them. However, he didn't leave any descriptive notes in his code so I'm not 100% sure that this is all the code I need to do this:
Option Compare Database
Option Explicit
Sub ValidateCDrive()
If Not CurrentDb.Name Like "C:\*" Then
MsgBox ("The file must be located on your C:\ drive.")
DoCmd.Quit
End If
End Sub
***Then in another module that opens a particular form, it does the following code upon load***
Private Sub Form_Load()
Me.TimerInterval = Nz(DLookup("TimerInterval", "tblForms", "FormName = '" & Me.Name & "'"), 0) * 1000
Debug.Print Me.TimerInterval
ValidateCDrive
InitializeUser
ResetForm
End Sub
****
I think where I'm a little confused is why this subroutine is called on a particular form's code, when this validation code runs wright when you open the database. The form module that it is called from does not open automatically when opening the database.
Additionally, I am wondering what the translation of the Me.TimerInterval is so if anybody could tell me what that does exactly, that would be awesome!
Thanks
Nicole