ComponentOne VSView Reporting Edition
GetRecordSource Method

Processes the PARAMETERS clause in the RecordSource string and returns the result.

Syntax

strVal = dataSource.GetRecordSource(Prompt As Boolean)

Remarks

This property is related to the RecordSource property. The RecordSource property sets or returns a string that specifies the source recordset for the report, and it may contain a PARAMETERS clause that causes VSReport to prompt the user for information. If you wanted to use the value of the RecordSource property to open a recordset directly from your program, you would have to parse the PARAMETERS clause yourself.

The GetRecordSource method handles the PARAMETERS clause and returns a string (SQL statement or table name) that can be used to open a recordset directly.

If the Prompt parameter is set to True, user will be prompted for the parameters before the method returns. If Prompt is set to False, the default values will be used. For example, the code below uses the GetRecordSource method to build a DAO recordset for a report:

' get recordsource string

Dim strRS As String

strRS = vsr.DataSource.GetRecordSource(True)

 

' open DAO recordset

Dim db As DAO.Database

Dim rs As DAO.Recordset

Set db = OpenDatabase("c:\Program Files\VS\VB98\NWind.mdb")

Set rs = db.OpenRecordset(strRS, dbOpenDynaset)

 

' assign DAO recordset to vsr control

vsr.DataSource.Recordset = rs

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback