RecordSource related Properties

See Also    Examples    Applies To

atb control

Property SqlSelect As String

atb.SqlSelect [ = strSelect]

Returns/sets the SELECT clause (without the keyword SELECT) of the SQL-String that determines the contents of the atb.

Property SqlFrom As String

atb.SqlFrom [ = strFrom]

Returns/sets the FROM clause (without the keyword FROM) of the SQL-String that determines the contents of the atb.

Property SqlWhere As String

atb.SqlWhere [ = strWhere]

Returns/sets the WHERE clause (without the keyword WHERE) of the SQL-String that determines the contents of the atb.

Property SqlOrderBy As String

atb.SqlOrderBy [= strOrderBy]

Returns/sets the ORDER-BY clause (without the keyword ORDER BY) of the SQL-String that determines the contents of the atb.

Property RecordSource As String

atb.RecordSource [ = strRecordSource]

Returns/sets the SQL string that determines the contents of the atb.

Property Filter As String

atb.Filter [ = strFilter }

Returns or sets a filter expression, that limits the recordset

Property OrderBy As String

atb.OrderBy [ = strOrderBy]

Returns or sets a filter expression, that limits the recordset

RecordSource is the traditional interface used to specify the recordset. As an alternative (and better) the Sql.. properties may be used. Calling the method Refresh with the parameter WithRecordSource sets the property Recordset according to the Sql... properties or the property RecordSource, respectively.

The different properties influence each other like listed below:

  1. Setting the RecordSource sets the Sql... properties too.
  2. Setting the RecordSource or Sql... properties deletes the properties Filter and OrderBy.
  3. Setting the Sql... properties sets the property RecordSource.
  4. Setting the property Filter or the property OrderBy sets the property RecordSource but without any influence on the Sql... properties.
  5. Setting the property Filter sets limitations that operate in addition to the property SqlWhere. If the property Filter is set to an empty String then the recordset is limited only by the property SqlWhere.
  6. Setting the property OrderBy sets the sort order that temporary replaces the sort order specified by the property SqlOrderBy. If the property OrderBy is set to an empty string then the permanent sort order specified by the property SqlOrderBy is active again.

These rules together may be viewed as followed:

  1. The primary recordset is defined by the Sql... properties.
  2. The property RecordSource may be used as an alternative to the Sql... properties.
  3. The recordset may be temporary limited using the property Filter.
  4. The recordset may be temporary ordered using the property OrderBy.

Universal Quote Support

Filter, OrderBy and the Sql... properties are supporting Universal Quotes. If the names of your tables or fields are containing special characters, you have to surround the name with quotes. Unfortunately every provider uses its own characters for quoting (e.g. Jet uses `, SQL Server and Oracle use "). You may use chr(1) and chr(2) as leading and trailing Universal Quotes respectively. The atb control translates these Universal Quotes into the proper quotes for your provider. Translation is done on writing the property, if you are reading the property, you will get the translated quotes. The connection of the atb control has to be open when translation is performed.

Example:

atb1.SqlFrom = chr(1) & strMyTable & chr(2)

cbo control

Property RecordSource As String

cbo.RecordSource [ = strRecordSource]

Returns/sets the SQL string that determines the contents of the cbo control.