Results 1 to 7 of 7
  1. #1
    agiuga is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2017
    Posts
    7

    Problem with Booking form with subform -Can't enter a new record

    I have created a booking form based on a query which has Booking table, Customer table, Dog table, Treatment table and a bridge BookingTreatment table (the subform). This table has a booking and Treatment composite primary key. As you can see the form won't let me enter a new record for an existing customer and dog id, which will update the booking table and bridge. It will show existing booking details. The treatment ID is taken from the bridge. It's probably simple but I can't see the answer. Any help would be great.
    Click image for larger version. 

Name:	bookingform.PNG 
Views:	15 
Size:	16.0 KB 
ID:	27462

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 10 Access 2013 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Perhaps this link will explain your situation: http://allenbrowne.com/ser-61.html

  3. #3
    agiuga is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2017
    Posts
    7
    Quote Originally Posted by RuralGuy View Post
    Perhaps this link will explain your situation: http://allenbrowne.com/ser-61.html
    Thanks. Nothing obvious. The form will allow me to enter non primary key fields.

  4. #4
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    there is no need for composite keys. You state there is a Booking table but those fields do not appear to be sub form fields, so I will presume you've joined them in a query and this query is not updateable. Instead work directly with tables, and use multiple sub forms inside your main form.

    In general: redo your primary table so there is one 1 key field, and it is an autonumber. That could be one of your current ID fields, I can't say - or it can be an entirely new field. For the moment we'll call it the AutoKey field. If there are other ID fields in this main table you can set their property to Indexed, No Duplicates if you wish, but do not designate them as key fields. If the other ID fields are other tables - use sub forms.

    in a table of a sub form - this table must also have its own Autonumber Key field - let's call it SubAutoKey field that is the primary key. It must also have the AutoKey field which is a Number field. Delete your current sub form, and then reset it into the main form and the wizard will set up so that main table's AutoKey will populate into sub table's AutoKey.

  5. #5
    agiuga is offline Novice
    Windows 10 Access 2010 32bit
    Join Date
    Feb 2017
    Posts
    7
    Thanks
    I had seen video tutorials where a query is used consisting of multiple tables to create a booking form. Maybe they were designed to view existing bookings rather than create new ones. Do bridge tables normally use its own primary key then rather than composite based on the linked tables?

  6. #6
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    There is no formal definition of a "bridge" table - so one can't be sure what is meant by that. Composite keys are never needed. They are possible - but never needed - and confuse things. I will guess that you have tables:
    * Customers
    * CustomersDogs (assuming multiple dogs to a customer)
    * Bookings
    * BookingSessions (assuming multiple sessions to a booking)

    I would think that you would have a Customer Form (with the Customer Dogs as a sub form) stand alone to first enter this information.

    The Booking form is somewhat complex. It would have the Booking Sessions as possibly a continuous sub form within it. You would have a selector to select a Customer from among the Customer table and then a second selector that is a cascading combo box that provides a choice of that selected customer's dogs.

  7. #7
    ssanfu is offline Master of Nothing
    Windows XP Access 2010 32bit
    Join Date
    Sep 2010
    Location
    Anchorage, Alaska, USA
    Posts
    9,664
    Maybe these will help you

    Read this (at least 5 time - several important concepts here).
    Microsoft Access Tables: Primary Key Tips and Techniques
    http://www.fmsinc.com/free/newtips/primarykey.asp


    Autonumbers--What they are NOT and What They Are
    http://www.utteraccess.com/wiki/index.php/Autonumbers


    This also has important concepts - especially this paragraph: Primary Key Should be One Field and Numeric.
    Microsoft Access Performance Tips to Speed up Your Access Databases
    http://www.fmsinc.com/microsoftaccess/Performance.html

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 5
    Last Post: 05-23-2015, 12:54 AM
  2. Replies: 29
    Last Post: 01-29-2014, 01:04 PM
  3. Replies: 14
    Last Post: 08-01-2013, 09:46 PM
  4. Replies: 1
    Last Post: 06-09-2013, 09:21 AM
  5. Replies: 6
    Last Post: 08-22-2012, 03:24 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums