Charlotte Foust
cfoust at infostatsystems.com
Thu Oct 30 10:09:36 CST 2003
You MUST have the DAO reference if you want to declare db as a Database
object. There is no database object in ADO and the built-in support for
some DAO operations in AXP doesn't exist in A2k. You can declare db as
an Object instead of a database. Here's some code from the code
librarian that will do it. I'm posting it because I could NOT find it
in on-line help(less).
Function AddCustomProperty(strName As String, _
varType As Variant, _
varValue As Variant) As Boolean
' The following generic object variables are required
' when there is no reference to the DAO 3.6 object library.
Dim objDatabase As Object
Dim objProperty As Object
Const PROP_NOT_FOUND_ERROR = 3270
Set objDatabase = CurrentDb
On Error GoTo AddProp_Err
objDatabase.Properties(strName) = varValue
AddCustomProperty = True
AddProp_End:
Exit Function
AddProp_Err:
If Err = PROP_NOT_FOUND_ERROR Then
Set objProperty = objDatabase.CreateProperty(strName, varType,
varValue)
objDatabase.Properties.Append objProperty
Resume
Else
AddCustomProperty = False
Resume AddProp_End
End If
End Function
Charlotte Foust
-----Original Message-----
From: Hollis,Virginia [mailto:HollisVJ at pgdp.usec.com]
Sent: Thursday, October 30, 2003 7:03 AM
To: 'Access Developers discussion and problem solving'
Subject: [AccessD] db As Database - A2K
When I converted a database from 97 to 2K I receive an error on: "Public
db As Database ' need not declare db in individual modules/forms"
I realize I need to add the reference to MS DAO 3.6. What can I do to
change this line of code so I don't have to add the reference?
Also, I tried to comment out the line, but receive an error on my
startup
properties:
ChangeProperty "StartupForm", dbText, "Switchboard"
I don't remember the dbText being there before - is that correct?
Virginia
_______________________________________________
AccessD mailing list
AccessD at databaseadvisors.com
http://databaseadvisors.com/mailman/listinfo/accessd
Website: http://www.databaseadvisors.com