SQL Object
 
Syntax
 
SQL.RunQuerySearch SrchWords, FldNames(), TableName, Records[, CursorType] _
                   [, LockType][, Location][, CacheSize] _
                   [, TimeOut][, MaxRecords]
 
Description
Builds a complex SELECT query using keywords and a list of fields to search in the specified table. The result is placed in an ADODB recordset, with the usual recordset parameters,.
 
This function is optimized for querying complex search queries; Its search power is comparable to that of well-known search engines on the Internet. For an explanation of the search capabilities, see the explanation in the general guide.
 
Parameter
Description
SrchWords
One or more search arguments separated by spaces
FldNames()
A string array of field names to be searched in. These must be fields of type CHAR, VARCHAR or TEXT.
TableName
The name of the Table of View being searched in.
Records
The ADODB record set with the result.
Cursortype
Optional. The type of connection to the record set, see below: CursorTypeEnum.
Locktype
Optional. The type of locking mechanism applicable to this record set, see below: LockTypeEnum.
Location
Optional. The method of server access for this record set, see below: CursorLocationEnum.
CacheSize
Optional. The record buffer of the opened recordset, set to 50 by default.
TimeOut
Optional. Specifies the maximum wait time in seconds for the query. If the result does not appear within the specified time, the query is aborted and an error message is generated. Default value: 30 seconds.
MaxRecords
Optional. Specifies the maximum number of records that may be included in the result. Default value: -1 (unlimited number of records)
 
 
CursorTypeEnum Constants 
 
Constant
Value
Description
adOpenDynamic
2
A dynamic cursor with both forward and backward scrolling where additions, deletions, insertions, and updates made by other users are visible
adOpenForwardOnly
0
Default, a forward scrolling only, static cursor where changes made by other users are not visible
adOpenKeyset
1
A keyset cursor allows you to see dynamic changes to a specific group of records but you cannot see new records added by other users
adOpenStatic
3
A static cursor allowing forward and backward scrolling of a fixed, unchangeable set of records
adOpenUnspecified
-1
Cursor type not specified
 
 
LockTypeEnum Constants 
 
Constant
Value
Description
adLockBatchOptimistic
4
Multiple users can modify the data and the changes are cached until BatchUpdate is called
adLockOptimistic
3
Multiple users can modify the data which is not locked until Update is called
adLockPessimistic
2
The provider locks each record before and after you edit, and prevents other users from modifying the data
adLockReadOnly
1
Read-only data
adLockUnspecified
-1
Lock type unknown
 
 
CursorLocationEnum Constants 
 
Constant
Value
Description
adUseClient
3
Uses a client-side cursor provided by the local library
adUseClientBatch
3
Obsolete
adUseNone
1
Obsolete
adUseServer
2
Uses a server-side cursor provided by the local library
 
See Also
other SQL.RunQueryxxxxxxxx functions, ADODB.Recordset.
Example
 
Sub Main
 
   Dim sZoek As String
   Dim Flds(0 to 4) As String
   Dim rsRec As ADODB.Recordset
 
   Flds(0) = "BedrijfsNaam"
   Flds(1) = "Adres"
   Flds(2) = "Postcode"
   Flds(3) = "Woonplaats"
   Flds(4) = "Land"
 
   sZoek = InputBox$("Trefwoorden:")
   If Len(sZoek) = 0 Then End
 
   SQL.RunQuerySearch sZoek, Flds(), "Klanten", rsRec
 
   Do While Not rsRec.Eof
      Debug.Print rsRec(0), rsRec(1), rsRec(2), rsRec(3), rsRec(4)
      rsRec.MoveNext
   Loop
 
   Set RsRec = Nothing
 
End Sub