394,071 Members | 3,687 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 394,071 IT Pros & Developers. It's quick & easy.

how to call a function residing in a module

Parasyke
P: n/a
Does anyone know to call a function residing in a module: I need it to
be called when my flash screen is launched when the app is opened. Here
is the code for the module (it sets some paramters for disallowing
special keys, etc.) (Should I use DoCmd?, Call?) I don't use modules
very often obviously (Thanks for any help!!):

Function SetStartupProperties() As Boolean
On Error GoTo SetStartupProperties_ERR
If gintSetStartup 0 Then
If gintSetStartup = 100 Then
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, False
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, False
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False
SetStartupProperties = False
Else
ChangeProperty "StartupShowDBWindow", dbBoolean, True
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
ChangeProperty "AllowFullMenus", dbBoolean, True
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, True
ChangeProperty "AllowBypassKey", dbBoolean, True
SetStartupProperties = True
End If
Else
If Dir("C:\Program Files\BReadMe.txt") = "" Then
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, False
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, False
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False
SetStartupProperties = False
Else
ChangeProperty "StartupShowDBWindow", dbBoolean, True
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
ChangeProperty "AllowFullMenus", dbBoolean, True
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, True
ChangeProperty "AllowBypassKey", dbBoolean, True
SetStartupProperties = True
End If
End If
SetStartupProperties_Exit:
Exit Function
SetStartupProperties_ERR:
MsgBox "The following error occured: -- " & Err.Description,
vbOKOnly + vbCritical, "SetStartupProperties Error"
GoTo SetStartupProperties_Exit
End Function

Nov 20 '06 #1
Share this Question
Share on Google+
3 Replies


Rick Brandt
P: n/a
"Parasyke" <kress1963nov22@yahoo.comwrote in message
news:1164059485.314316.138390@m7g2000cwm.googlegro ups.com...
Does anyone know to call a function residing in a module: I need it to
be called when my flash screen is launched when the app is opened. Here
is the code for the module (it sets some paramters for disallowing
special keys, etc.) (Should I use DoCmd?, Call?) I don't use modules
very often obviously (Thanks for any help!!):
Just plain old...

SetStartupProperties

--
Rick Brandt, Microsoft Access MVP
Email (as appropriate) to...
RBrandt at Hunter dot com
Nov 20 '06 #2

Larry Linson
P: n/a
You won't be able to check the return value, but you could just move the
other code to the Load event of the Form that you set to be automatically
run at Startup in Tools | Startup.

Larry Linson
Microsoft Access MVP

"Parasyke" <kress1963nov22@yahoo.comwrote in message
news:1164059485.314316.138390@m7g2000cwm.googlegro ups.com...
Does anyone know to call a function residing in a module: I need it to
be called when my flash screen is launched when the app is opened. Here
is the code for the module (it sets some paramters for disallowing
special keys, etc.) (Should I use DoCmd?, Call?) I don't use modules
very often obviously (Thanks for any help!!):

Function SetStartupProperties() As Boolean
On Error GoTo SetStartupProperties_ERR
If gintSetStartup 0 Then
If gintSetStartup = 100 Then
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, False
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, False
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False
SetStartupProperties = False
Else
ChangeProperty "StartupShowDBWindow", dbBoolean, True
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
ChangeProperty "AllowFullMenus", dbBoolean, True
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, True
ChangeProperty "AllowBypassKey", dbBoolean, True
SetStartupProperties = True
End If
Else
If Dir("C:\Program Files\BReadMe.txt") = "" Then
ChangeProperty "StartupShowDBWindow", dbBoolean, False
ChangeProperty "StartupShowStatusBar", dbBoolean, False
ChangeProperty "AllowBuiltinToolbars", dbBoolean, False
ChangeProperty "AllowFullMenus", dbBoolean, False
ChangeProperty "AllowBreakIntoCode", dbBoolean, False
ChangeProperty "AllowSpecialKeys", dbBoolean, False
ChangeProperty "AllowBypassKey", dbBoolean, False
SetStartupProperties = False
Else
ChangeProperty "StartupShowDBWindow", dbBoolean, True
ChangeProperty "StartupShowStatusBar", dbBoolean, True
ChangeProperty "AllowBuiltinToolbars", dbBoolean, True
ChangeProperty "AllowFullMenus", dbBoolean, True
ChangeProperty "AllowBreakIntoCode", dbBoolean, True
ChangeProperty "AllowSpecialKeys", dbBoolean, True
ChangeProperty "AllowBypassKey", dbBoolean, True
SetStartupProperties = True
End If
End If
SetStartupProperties_Exit:
Exit Function
SetStartupProperties_ERR:
MsgBox "The following error occured: -- " & Err.Description,
vbOKOnly + vbCritical, "SetStartupProperties Error"
GoTo SetStartupProperties_Exit
End Function

Nov 20 '06 #3

BillCo
P: n/a

I dont like macros, but just to give you more options there are two
ways of doing this with macros:

- you could create a macro and name it autoexec. then call the function
from the macro.
- Or you could name it something else and create a shortcut that
launches the database with the macro name as a parameter.

Nov 21 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.