![]() | |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
snip... When I try to set the recordset index after opening the recordset, I get the error "index does not exist". The index I am trying to use is a segmented one. I need to do this so that I can Seek a record. I have used BtSearch and the indexes are clearly visible in there for the dataset in question. |
#3
| |||
| |||
|
|
snip... When I try to set the recordset index after opening the recordset, I get the error "index does not exist". The index I am trying to use is a segmented one. I need to do this so that I can Seek a record. I have used BtSearch and the indexes are clearly visible in there for the dataset in question. Do ddf's reflect correct indexes? If so, are fields for each segment defined? You can test segmented indexes w/matching ddf's using the Pvsw\Demodata. Billing, Class, Department, Enrolls, Faculty, Person and Room will have an index to test. |
#4
| |||
| |||
|
#5
| |||
| |||
|
|
ddf's if at all possible should exactly match btrieve indexes. Make sure Index is specified before opening. Below is a VB6 example using Class table and segmented index "Class_Name". Dim RS As New ADODB.Recordset With RS .CursorLocation = adUseServer .Index = "Class_Name" .Open "Class", "Provider=PervasiveOLEDB;Data Source=DEMODATA", adOpenStatic, adLockOptimistic, adCmdTableDirect .Seek Array("PSC 101", "002"), adSeekFirstEQ Debug.Print "Name=" & !Name & ";Section=" & !Section .Close End With Set RS = Nothing |
#6
| |||
| |||
|
|
The fields in the index are "Pallet_Number" and "Purchase_Order_Number" and using rst.index="Purchase_Order_Number" etc sill returns index not found |
#7
| |||
| |||
|
|
The fields in the index are "Pallet_Number" and "Purchase_Order_Number" and using rst.index="Purchase_Order_Number" etc sill returns index not found |
#8
| |||
| |||
|
|
The fields in the index are "Pallet_Number" and "Purchase_Order_Number" and using rst.index="Purchase_Order_Number" etc sill returns index not found Index name is what it is, don't confuse it with a field name. If your index is segmented in this order: "Pallet_Number", "Purchase_Order_Number" and only care about "Purchase_Order_Number", find another index that has "Purchase_Order_Number" as the first or only segment. If the segment order is "Purchase_Order_Number", "Pallet_Number" then this will work: rst.Index = ? (either the number or *Index name*) Open the recordset, then rst.Seek Array(PO number looking for, smallest value for Pallet_Number), adSeekAfterEQ Loop until rst!Purchase_Order_Number <> PO number looking for or rst.EOF Here, a simple segmented index example. Two fields *FName* and *LName* are indexed with an Index name of *idx_LFName*, segmented as follows, LName, FName. Using this index would be a snap for all Jones (last name) but useless for Jack (first name). The data looks like this: (both fields are 10,bytes) Jaminson..Freddy.... Jones.....Barney.... Jones.....Jack...... Smith.....Art....... Wilkerson.Jack...... rst.Index = "idx_LFName" Open the recordset, then rst.Seek Array("Jones", ""), adSeekAfterEQ will take me to: Jones.....Barney.... loop until rst!LName <> Jones or rst.EOF and give me 2 Jones. Now, using this index and looking for Jack via Seek would look like this: rst.Index = "idx_LFName" Open the recordset, then rst.Seek Array("", "Jack"), adSeekAfterEQ will take me to: Jaminson..Freddy.... loop until rst!FName <> Jack or rst.EOF and give me 0 Jacks. Using this index to get our 2 Jacks would require this. rst.Index = "idx_LFName" Open the recordset, then loop until rst.EOF, checking rst!FName = Jack for each record Remember, anytime you use a segmented index and Seek, Array function must be used and equal to number of segments. - Don |
#9
| |||
| |||
|
#10
| |||
| |||
|
|
Despite using both the index name and index number I still cannot open the recordset and set the index. |
|
I can do this with the other data sets in this application but this one dataset still eludes me. |
![]() |
| Thread Tools | |
| Display Modes | |
| |