hans:
if the addresses are actually in the report, you’ll want to use the Columns class. this class will give you access to individual cell contents. the columns class will have 1 item for each column in the Select statements in the SQL. please note that when bo generates multipass sql, the columns common to all select statements will only be populated accurately in the first select statement. so, if you have 2 select statements, and the first returns country resor and guests, and the second returns country, resort and revenue, you’ll have 6 items in the columns class. the first country and resort columns will be populated, as well as the revenue and guests columns. the second country and resort columns will be empty or 0.
a good example of this is the ANNUAL.RPT document that comes with bo and access the EVALKIT universe.
the following code will help illustrate the point.
frank b. duncan
decision support specialist
national city corp.
frank_b_duncan@national-city.com
011 216 488-7677
Sub Main
Dim myResults As BOResults
Dim myColumns As BOColumns
Dim myColumn As BOColumn
Dim intResults As Integer
Dim intColumns As Integer
Dim intI As Integer
Dim intJ As Integer
Set myColumns=ActiveDocument.DataProviders.Item(1).Columns Set
myResults=ActiveDocument.DataProviders.Item(1).Queries.Item(1).Results
intColumns=myColumns.Count
intResults=myResults.Count
MsgBox "Number of Columns: " + str$(intColumns) + Chr$(13) + _
"Number of Results: " + str$(intResults),0,“Statistics”
MsgBox “First, the Results.”,0,“Access Results”
For intI = 1 to intResults
MsgBox "Class: " + myResults.Item(intI).Class + Chr$(13) + _
"Object: " + myResults.Item(intI).Object,0,“Result Object #”+ Str$(intI)
Next intI
MsgBox “Unfortunately, you cannot get individual” + Chr$(13) + _
“cells from the the Results Object.”,0,“C’est dommage!”
MsgBox “Now, for the Columns.”,0,“Access Columns”
’ this block of code gets each column, then prints each row in the column
’ if you are looking for a specific colummn, you can ignore the outer loop,
’ as its only function is to get the appropriate column. here, you could
’ remove the intI For/Next loop then use ’ Set myColumn = myColumns.Item(“colname”) where “colname” is ’ the column with the email addresses.
’ you can also change the myColumn.Count to 2 or 3 to see just a few of the rows
For intI = 1 to intColumns
Set myColumn = myColumns.Item(intI)
For intJ=1 to myColumn.Count
MsgBox myColumn.Name + " Row #" + Str$(intJ) + ": " + Str$(myColumn.Item(intJ)), _
0,“Column #”+ Str$(intI) + " " + myColumn.Name Next intJ
Next intI
End Sub
______________________________ Reply Separator _________________________________
Date: 11/12/98 4:06 PM
Is it possible to get a variable from a report? Application.Variables.Item(“variable name”) doesn’t work for some reason.
I want to set a list of email address to send out a report in the report itself.
hans
hans kingma
unisource carrier services
industriestrasse 21
8403 wallisellen
switzerland
phone: +41 1 839 32 65
fax: +41 1 877 4490
Listserv Archives (BOB member since 2002-06-25)