Results 1 to 3 of 3
  1. #1
    Join Date
    Mar 2004
    Posts
    9

    Unanswered: Adding a new Record, but the Primary key is not An Autonumber

    Situation:

    A library database:

    1.the identification number for a Book is not an autonumber, but something like this: 10001.
    How to i go about adding a new book on my form, without the form having to show the person what the last number for a book was entered into the tables, and them letting them enter the new Book_ID.

    Can i just let them enter the Book name and other stuff and let access handle the assigning of the Book_ID.

    2. On the same topic, I have two tables that i want to interact with: Authors and Books. An author can write more than one book. The link between the tables is Author_ID. Where the Author_ID is the primary key of the Author table. So if i want to add a new book and the author does not exist yet (its a new author), how to I do that?
    Human_fuel

  2. #2
    Join Date
    Aug 2003
    Location
    Argentina
    Posts
    465

    Re: Adding a new Record, but the Primary key is not An Autonumber

    Originally posted by human_fuel
    Situation:

    A library database:

    1.the identification number for a Book is not an autonumber, but something like this: 10001.
    How to i go about adding a new book on my form, without the form having to show the person what the last number for a book was entered into the tables, and them letting them enter the new Book_ID.

    Can i just let them enter the Book name and other stuff and let access handle the assigning of the Book_ID.

    2. On the same topic, I have two tables that i want to interact with: Authors and Books. An author can write more than one book. The link between the tables is Author_ID. Where the Author_ID is the primary key of the Author table. So if i want to add a new book and the author does not exist yet (its a new author), how to I do that?
    Human_fuel
    For the first topic in the form set the property DataEntry to No.
    For the second topic make a form whose record source is the table Authors. Make a subform linked with the form by Authors whose record
    source is the table Books.
    Saludos
    Norberto

  3. #3
    Join Date
    Sep 2001
    Location
    Chicago, Illinois, USA
    Posts
    601
    On the BeforeInsert event of the form, you can automatically set the value of that special book number field. You might have code something like this:

    [SpecialBookNumberField]=DMax("[SpecialBookNumber]","tblBooks")+1

    The main problem w/this technique is in a multi-user environment. Is this going to be a multi-user database ?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •