W
Wez.k
How do I "set dbs = " to something other than CurrentDB?
I am creating a new database from Vb and I want to set the startup
properties as the database is crearted so that a form opens when the database
starts. I've found out how to do that in the current database, but I cant
make it work for the newly created database. Code from online help is as
follows:
Sub SetStartupProperties()
Const DB_Text As Long = 10
Const DB_Boolean As Long = 1
ChangeProperty "StartupForm", DB_Text, "SYM grp inst request form"
ChangeProperty "StartupShowDBWindow", DB_Boolean, False
ChangeProperty "StartupShowStatusBar", DB_Boolean, False
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, False
ChangeProperty "AllowFullMenus", DB_Boolean, False
ChangeProperty "AllowBreakIntoCode", DB_Boolean, True
ChangeProperty "AllowSpecialKeys", DB_Boolean, False
ChangeProperty "AllowBypassKey", DB_Boolean, False
End Sub
*******************
Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270
**** Set dbs = CurrentDB (I would like this to be my new database) ****
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
Thanks
I am creating a new database from Vb and I want to set the startup
properties as the database is crearted so that a form opens when the database
starts. I've found out how to do that in the current database, but I cant
make it work for the newly created database. Code from online help is as
follows:
Sub SetStartupProperties()
Const DB_Text As Long = 10
Const DB_Boolean As Long = 1
ChangeProperty "StartupForm", DB_Text, "SYM grp inst request form"
ChangeProperty "StartupShowDBWindow", DB_Boolean, False
ChangeProperty "StartupShowStatusBar", DB_Boolean, False
ChangeProperty "AllowBuiltinToolbars", DB_Boolean, False
ChangeProperty "AllowFullMenus", DB_Boolean, False
ChangeProperty "AllowBreakIntoCode", DB_Boolean, True
ChangeProperty "AllowSpecialKeys", DB_Boolean, False
ChangeProperty "AllowBypassKey", DB_Boolean, False
End Sub
*******************
Function ChangeProperty(strPropName As String, varPropType As Variant,
varPropValue As Variant) As Integer
Dim dbs As Object, prp As Variant
Const conPropNotFoundError = 3270
**** Set dbs = CurrentDB (I would like this to be my new database) ****
On Error GoTo Change_Err
dbs.Properties(strPropName) = varPropValue
ChangeProperty = True
Change_Bye:
Exit Function
Change_Err:
If Err = conPropNotFoundError Then ' Property not found.
Set prp = dbs.CreateProperty(strPropName, _
varPropType, varPropValue)
dbs.Properties.append prp
Resume Next
Else
' Unknown error.
ChangeProperty = False
Resume Change_Bye
End If
End Function
Thanks