Click to See Complete Forum and Search --> : Two Primary Keys
JHausmann
Aug 11th, 1999, 01:05 AM
Please clarify.
You have two uniquekeys or you have a primary key that is made up from 2 fields?
Lloyd
Aug 11th, 1999, 11:29 AM
Hi!,
I am trying to search a Access 97 database using 2 primary keys but I have no idea how to use 2 primary keys to search Access. 1 yes, 2 no. Can anyone help point me in the right direction? Thanks!!
Lloyd
evolution-x
Aug 11th, 1999, 11:37 AM
First of all, why would you need 2 primarykeys in a table. Secondly if both of them are primary or rather unique key, you just have to search for one. If you are talking about a primarykey made up of 2 fields, then the code is simple.
dim tbl as database
dim rst as recordset
set tbl = THEDATABASEFILE/LOCATION
set rst = tbl.opendatabase("THETABLENAME", dbopentable)
rst.index = "primarykey"
rst.seek "=", FIELD1, FIELD2
if rst.nomatch ...
bla..bla...
Lloyd
Aug 11th, 1999, 05:44 PM
Thanks!! I got it working (well half way but I think I can handle it from here.)
Thanks for the help!!
Lloyd
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.