robneil1
asked on
Create Index on .mdb at runtime
I need to check if an index exists on the version of the .mdb i am accessing. If it does not exist then i need to create it permanently in the .mdb .
This is how i am opening the .mdb
Function Opitx()
cnn.Provider = "Microsoft.Jet.OLEDB.4.0;"
cnn.Open Trim(App.Path) & "\Awol.MDB"
Set rs = New ADODB.Recordset
rs.Open "wol", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
End Function
-------------------------- ---------- ---------- -
thsi is the current bit of code where i need to create the index.
I have used on error to find if the index exists. (is there a better way?)
rs.Index = ("TITLE")
If Check3 = 1 Then
On Error GoTo nocomposer
rs.Index = ("COMPOSER")
GoTo composerok
nocomposer:
On Error GoTo 0
MsgBox ("No Composer Index , This is an OLD Database, hit enter to continue")
Text1 = ""
Text1.Refresh
' Create the NewIndex
**************i need the code to create an index
Index name composer
Field comp
I need the index to be permanent
**************
Would not mind to know how to create index with multiple fields say field names = comp and title
Appreiate any help
This is how i am opening the .mdb
Function Opitx()
cnn.Provider = "Microsoft.Jet.OLEDB.4.0;"
cnn.Open Trim(App.Path) & "\Awol.MDB"
Set rs = New ADODB.Recordset
rs.Open "wol", cnn, adOpenKeyset, adLockOptimistic, adCmdTableDirect
End Function
--------------------------
thsi is the current bit of code where i need to create the index.
I have used on error to find if the index exists. (is there a better way?)
rs.Index = ("TITLE")
If Check3 = 1 Then
On Error GoTo nocomposer
rs.Index = ("COMPOSER")
GoTo composerok
nocomposer:
On Error GoTo 0
MsgBox ("No Composer Index , This is an OLD Database, hit enter to continue")
Text1 = ""
Text1.Refresh
' Create the NewIndex
**************i need the code to create an index
Index name composer
Field comp
I need the index to be permanent
**************
Would not mind to know how to create index with multiple fields say field names = comp and title
Appreiate any help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for your help, i was hoping not to use adox, but i gave it a go, and it does seem much more comprehensive.
regards, robneil1