GetRange

Method
Retrieves the values of a range filter for a field.

Category
Filters

 

Syntax
Function GetRange(ByVal hTable As Long, ByVal FieldNo As Long) As Variant

hTable
The handle to the table.

FieldNo
The number of the field whose range filter is to be retrieved.

 

Example

'Case "SetRangeGetRange"

'Lists all the customers between Parameter1 and Paramter2

  CF1.OpenTable hTable, 18

  tmpVar = frmCfrontTest.Text1(cf.SetRangeLow).Text

  tmpVar2 = frmCfrontTest.Text1(cf.SetRangeUpp).Text

  logWr "No. of records before setting range: " & Str$(CF1.RecCount(hTable))

  CF1.SetRange hTable, 1, tmpVar, tmpVar2

  logWr "No. of records after setting range: " & Str$(CF1.RecCount(hTable))

  tmpVar = CF1.GetRange(hTable, 1)

  If VarType(tmpVar) = vbVariant + vbArray Then

  logWr "Rangefilter retrieved: " & tmpVar(0) & ", " & tmpVar(1)

  Else

  logWr "GetRange failed"

  End If

 

  CF1.CloseTable hTable

 

Comments
GetRange retrieves the start and end values of the range filter for FieldNo. The values are returned as an array of type Variant. Thus, if the array is called V, V(0) contains the start value, and V(1) the end value.

GetRange can retrieve only a single interval, for example:

>=5 & <=8

A range more complex than this will cause the function to raise an exception.



© 2009 Microsoft Corporation. All rights reserved.