Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

seek on indexed table

Status
Not open for further replies.

kronar

Programmer
Jan 12, 2003
60
US
I have a table called JB_Jobs, The key field is JB_JobBibNo a text field, it has the key symbol in front of it and in its index property is Yes (no duplicates).

Code to use seek:
Set db = CurrentDb()
Set JBrec = db.OpenRecordset("JB_Jobs", dbOpenTable)
If Not JBrec.BOF And Not JBrec.EOF then 'at least one record exists in table
JBrec.Index = "JB_Jobs.JB_JobBidNo"

I get an error :"'JB_Jobs.JB_JobBidNo' isn't an index in this table"
What am I nissing??
 
kronar,
You'll need the name of the index, not the field name (once I figured this out the help file became more helpful).

The little key symbol means it's primary and if Access set it up it's probably called [tt]PrimaryKey[/tt].

One way to confirm this is open the table in design view, then click View > Indexes (or click the Indexes button on the Table Design toolbar). This will bring up the Indexes dialog which will show you the name and the components.

Another is to iterate the Indexes collection of your recordset in code.

Hope this helps,
CMP

[small]For the best results do what I'm thinking, not what I'm saying.[/small]
(GMT-07:00) Mountain Time (US & Canada)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top