G
Guest
Help would be greatly appreciated with the following.
I have created a database with a form and tables. On the
form I have created a test button. The code below
(fragment)is from an example in access (Index Property).
I have pasted this code on my form's code part and the
procedure Seek() is used in my test button procedure.
The problem is that I can't get the Seek() procedure to
work. The following error occurs..
Run-time error '-2147217867 (80040e35)'
EmployeeID is not an index in this table
This database does exist in the given directory. The
employees table does exist and employeeID is a field of
this table with the "key" symbol to the extreme left of
the screen.
How do I interpret the error and where have I gone wrong.
Public Sub SeekX()
Dim rst As ADODB.Recordset
Dim strID As String
Dim strPrompt As String
strPrompt = "Enter an EmployeeID (e.g., 1 to 9)"
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseServer
rst.Open "employees", _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Program Files\Microsoft
Office\Office\Samples\northwind.mdb;" & _
"user id=admin;password=;", _
adOpenKeyset, adLockReadOnly,
adCmdTableDirect
' "Data Source=c:\temp\northwind.mdb;" & _
' Does this provider support Seek and Index?
If rst.Supports(adIndex) And rst.Supports(adSeek) Then
rst.Index = "EmployeeID" ******** This is where the
error occurs *************
' Display all the employees.
I have created a database with a form and tables. On the
form I have created a test button. The code below
(fragment)is from an example in access (Index Property).
I have pasted this code on my form's code part and the
procedure Seek() is used in my test button procedure.
The problem is that I can't get the Seek() procedure to
work. The following error occurs..
Run-time error '-2147217867 (80040e35)'
EmployeeID is not an index in this table
This database does exist in the given directory. The
employees table does exist and employeeID is a field of
this table with the "key" symbol to the extreme left of
the screen.
How do I interpret the error and where have I gone wrong.
Public Sub SeekX()
Dim rst As ADODB.Recordset
Dim strID As String
Dim strPrompt As String
strPrompt = "Enter an EmployeeID (e.g., 1 to 9)"
Set rst = New ADODB.Recordset
rst.CursorLocation = adUseServer
rst.Open "employees", _
"Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=c:\Program Files\Microsoft
Office\Office\Samples\northwind.mdb;" & _
"user id=admin;password=;", _
adOpenKeyset, adLockReadOnly,
adCmdTableDirect
' "Data Source=c:\temp\northwind.mdb;" & _
' Does this provider support Seek and Index?
If rst.Supports(adIndex) And rst.Supports(adSeek) Then
rst.Index = "EmployeeID" ******** This is where the
error occurs *************
' Display all the employees.