Re: can we set a primary key on a form in access database if yes how?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



=?Utf-8?B?UGQ=?= <Pd@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in
news:2573CDB2-D723-4BEE-A625-578644E11EC4@xxxxxxxxxxxxx:

Can someone tell me if there is a way to set primary key in form
view for access database, if yes how?

I'm not sure what you're question means, to be honest.

If you want a form to type in the value that will become the primary
key, you have to consider what you do when the user types in a value
that's already in use as a primary key.

My approach to this is to use a separate unbound form to collect the
data for the fields required to create a new record, and then check
to see if the resulting primary key already exists. If it does, you
tell the user and offer them some way around it. Once they've
entered data that won't create a collision, then you create the
record in DAO, and then load the new record in the main form for
them to fill out the other fields.

I have found this approach to be much more manageable than trying to
do the add in the same form as you do the edits.

--
David W. Fenton http://www.dfenton.com/
usenet at dfenton dot com http://www.dfenton.com/DFA/
.



Relevant Pages

  • Re: Primary Key Unexpectedly Gone from Table
    ... I don't understand how the entered data could violate the index when the PK ... where does the Function CreateIndexesDAO() in your ... there is no longer a Primary Key set. ... I cannot run any data definition code to set the PK on ...
    (microsoft.public.access.tablesdbdesign)
  • Re: Need help in my code
    ... This is my first project I work in, and I need help to solve a problem ... of entered data are defined as primary key or unique fields and should ...
    (comp.lang.java.programmer)