Add a default form in the start-up options.

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am writing the code to break an employee database down into 70 separate
databases (one for each manager containing their employees only). This is
due to the Sarbanes-Oxley Act. This is a Fortune 50 company. I have been
directed by the CEO and their Auditing firm to make this iron clad. The only
way to accomplish this is to create individual databases that only contain
that managers data. This data is proprietary to the specific manager. This is
going just fine. What I need to know is once I create the individual
databases how do I set the start-up options in each one of my sub-databases
from my Master Database utilizing VB. Thanks in advance.
 
I have written the following code which changes the Title and form in the
current database. How do I adjust the code to direct the changes to a
different database?

When I subsititue

Set dbs = DBEngine.Workspaces(0).OpenDatabase(strDBName)

for

Set dbs = CurrentDb

I get an error message at

Set prp = dbs.CreateProperty(strName, varType, varValue)

saying Error 13 Type Mismatch.

Any help would be appreciated.


Function AddAppProperty(strName As String, varType As Variant, varValue As
Variant, strDBName As String) As Integer

Dim dbs As database, prp As Property
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
' Set dbs = DBEngine.Workspaces(0).OpenDatabase(strDBName)
On Error GoTo AddProp_Err
dbs.Properties(strName) = varValue

AddAppProperty = True

AddProp_Bye:
Exit Function

AddProp_Err:
If Err = conPropNotFoundError Then
Set prp = dbs.CreateProperty(strName, varType, varValue)
dbs.Properties.Append prp
Resume
Else
AddAppProperty = False
Resume AddProp_Bye
End If
End Function
 
What version of Access (and how have you declared prp?)

Property is an object in both ADO and DAO. If you've got references to both
(as would be likely if you're using Access 2000 or newer), you need to
"disambiguate" the declaration as Dim prp As DAO.Property (to guarantee an
ADO property, you'd use Dim prp As ADODB.Property)
 
Why are you declaring varType as a variant? I believe it needs to be a Long
Integer.
 
Worked fantastically. I never would have guessed that would make a
difference. I copied that code from Access help. Thanks again.
 
I'm curious as to what example you copied from the Help file, as I couldn't
find any that included varType as a property.
 
Back
Top