Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 14th, 2005, 05:46 PM
Friend of Wrox
 
Join Date: Mar 2004
Posts: 217
Thanks: 0
Thanked 1 Time in 1 Post
Default Primary Key not acceptable for "Seek?"

I'm trying to learn to use the DAO library and am having a problem with using Seek on a table. I am trying to use it against tblAuthUsers2, where "AuthInit" is the Primary Key. I am getting an error saying that the field "Authinit" must be an Index! (I thought a PK WAS an index???) When I run Analyze it shows the only index in tblAuthUsers2 is "Primary Key". It's data type is text, and interestingly "required Property" was false- but when I changed it to "True" it still errored with the same message.

Dim db As DAO.Database
Dim rec As DAO.Recordset
Dim strUserPasswordInput As String ' hold password user gives Dim varFoundUserPW As Variant ' store
Dim strUserInitInput As String ' store user initials,
Dim strUserPWStored As String
Dim strUserInitStored As String
Dim intUserLevelStored As Integer

Set db = CurrentDb
Set rec = db.OpenRecordset("tblAuthUsers2")
rec.Index = "AuthInit" ' set up to use seek,

rec.Seek "=", strUserInitInput


Am I missing something important here? Is there something else I need to review? (Is the table goofy?)
Thanks,

Loralee









Similar Threads
Thread Thread Starter Forum Replies Last Post
Foreign key not updating with Primary key xavier1945 BOOK: Access 2003 VBA Programmer's Reference 2 July 4th, 2007 09:48 PM
Primary key cf2006 BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 July 31st, 2006 07:21 PM
FOREIGN KEY and PRIMARY KEY Constraints junemo Oracle 10 June 15th, 2004 01:00 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.