|
-
Oct 21st, 2000, 09:47 PM
#1
How can I define a new primary key for my access 97 mdb
from a vb form code?
-
Oct 23rd, 2000, 10:57 AM
#2
SQL
You can do this with SQL via an Execute statement (on your DAO database object or ADO connection object). You do it with either the 'CREATE TABLE' or 'ALTER TABLE' SQL statements using the 'CONSTRAINTS' clause. I suggest that you look up any or all of the above in the MS Access97 help because it's pretty clear there and far too much to write here! The only real trick is that you can name your constraints anything you want - as is illustrated by their examples.
You may need to use either a 'DROP' statement or an 'ALTER TABLE DROP CONSTRAINT' statement to get rid of an already existing PK before adding the new PK.
Good luck,
Paul
-
Oct 23rd, 2000, 07:18 PM
#3
-
Oct 24th, 2000, 11:40 AM
#4
Lively Member
I don't know about doing it on the fly, but at creation, have a look at this posting:
http://forums.vb-world.net/showthrea...threadid=29119
Look for the last reply.
Sincerely yours,
Patrice B. 
Information System Analyst
SAS 9.1.3, VB6 SP6, VB.Net 2003, SQL7.0/2000
-
Oct 24th, 2000, 07:17 PM
#5
Patrice, are codes compatible with access97?
-
Oct 30th, 2000, 12:32 PM
#6
Lively Member
Sorry for the delay... Didn't get any warning that a new message was posted...
I guess that it should work as well. I created Access97 and Access2000 MBD whitout a glitch.
Sincerely yours,
Patrice B. 
Information System Analyst
SAS 9.1.3, VB6 SP6, VB.Net 2003, SQL7.0/2000
-
Oct 30th, 2000, 10:08 PM
#7
Thanks, I tried it already.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|