properties.add

S

sTeve

Is there any way to create a description property for a table or
report in an ADP? I can change it if it already exists,
--------------------------------------------------------------------------------------------
I can change the Description of a report with the following code:

Public Function Change_Report_Description(strReportName As String,
str_New_Description As String)

On Error GoTo Err_Handler

CurrentProject.AllReports(strReportName).Properties("Description") =
str_New_Description

Err_Handler:
' Error 2455 means that the property was not found.
If Err.Number = 2455 Then
MsgBox "Error: The report does not have a description yet. It must
be manually created before it can be changed"
Resume Next
End If
End Function

--------------------------------------------------------------------------------------------------------
It can be done in DAO with the following code:

Dim prpNew As DAO.Property
Set db = CurrentDb
DoCmd.OpenReport stReport, acViewDesign

db.Containers("Reports").Documents(stReport).Properties("Description").Value
= stRecSrc
DoCmd.Close acReport, stReport, acSaveYes
Set db = Nothing
Err_Handler:
' Error 3270 means that the property was not found.
If err.Number = 3270 Then
Set prpNew =
db.Containers("Reports").Documents(stReport).CreateProperty("Description",
dbText, stRecSrc)
db.Containers("Reports").Documents(stReport).Properties.Append
prpNew

---------------------------------------------------------------------------------------------------------------
I've tried playing with the following:

currentproject.AllReports(strReportName).Properties.Add("Description","test")
whicht he assistant will let me construct, but it insists on placing
an "=" sign after it, and it won't compile.

thank you,

Steve Shapiro
Eugene, OR
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top