Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Other Forums
 MS Access
 Setting Property Object in ADP Project

Author  Topic 

jean
Starting Member

6 Posts

Posted - 2003-04-24 : 15:11:42
Hi, the code below works fine with (Access 97)MDB but not in ADP Project (Microsoft Access 2002),
I did include the DAO library but still it doesnt work. Any solutions to this problem?.

The following example shows how to change the AppIcon and AppTitle properties. If the properties haven't already been set or created, you must create them and append them to the Database object by using the CreateProperty method.

Sub cmdAddProp_Click()
Dim intX As Integer

intX = AddAppProperty("AppTitle", dbText, "My Custom Application")
intX = AddAppProperty("AppIcon", dbText, "C:\Windows\Cars.bmp")
RefreshTitleBar
End Sub

Function AddAppProperty(strName As String, varType As Variant, varValue As Variant) As Integer
Dim dbs As DAO.Database, prp As DAO.Property
Const conPropNotFoundError = 3270

Set dbs = CurrentDb
On Error GoTo AddProp_Err
dbs.Properties(strName) = varValue 'error part

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



jsmith8858
Dr. Cross Join

7423 Posts

Posted - 2003-04-24 : 16:32:32
ADP's have nothing to do with DAO ...

What is the error you get? where does it occur?

Does

dim db as dao.database
set db = currentdb
msgbox db.name

even work for ADP's ????

(don't have 2000 running right now at work ... still stuck with 97 !!!!!)


- Jeff
Go to Top of Page

jean
Starting Member

6 Posts

Posted - 2003-04-24 : 17:08:13
im am getting this error message "Object variable or With block variable not set"

on this part of the code
dbs.Properties(strName) = varValue

Go to Top of Page

ValterBorges
Master Smack Fu Yak Hacker

1429 Posts

Posted - 2003-04-29 : 22:20:36
Set a breakpoint at

Set dbs = CurrentDb

place a watch on each object and see it they are being created and initialized properly.



Go to Top of Page
   

- Advertisement -