Results 1 to 5 of 5
  1. #1
    tbjmobile@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    127

    Can I create a data entry form with a sub-form that contains all the related records in the table

    Is this possible, relatively easily?
    I have a data entry form for bookings, for owners letting out their properties. Occasionally they send us bookings that overlap other ones already sent, or that are inconsistent in some way with what we've already got. E.g the people that are leaving go late and people arriving come early.
    Can I place a sub-form on that data entry form, that shows a datasheet view of the customer's bookings that we already have? It doesn't HAVE to be a data entry form as such, so long as I can add an 'Add new record button', so that as soon as I type in the property code, the datasheet below filters on the records we already have for that code.


    Thanks as always.

  2. #2
    Join Date
    Apr 2017
    Posts
    1,776
    A customer form with continuous bookings subform, linked by customer ID. And no need for 'Add ...' button, as new records simply added into subform are automatically linked to customer. NB! A continuous form, not a datasheet!

  3. #3
    tbjmobile@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    127
    Thank you, but I don't think I explained properly what I'm looking for. It's a data entry form, with a datasheet view of ALL of the records of the same code as the one being entered, nothing to do with the customer table. The data that I'll be entering is actually into the same table. When I enter the code, I would like all of the records that we already have with that same code, in that same table view below or above. The customer code is just what tells us which property (and customer) within that same table.
    Sorry !

  4. #4
    Join Date
    Apr 2017
    Posts
    1,776
    The main for in design I adviced is based on customer table, which has CustomerID as primary key (or whatever table having the code you are talking about as primary key, or unbound form with unbound control to select the same code). There you select a customer or whatever other characteristic - and doing this you select the code you need to get the proper set of records in subform.

    Then you design a continuous form based on bookings table. NB! the bookings table must contain CustomerID (or whatever you have for code) as foreign key, and you must have a control for it in form, but you hide it. User hasn't any need to see it, and he/she MUST NOT edit it!

    Now you open the main form in edit mode, and drag the continuous form into it. Access creates automatically a subform control with continuous form as source (by default with same name as the form in source - it will be better to rename it). When linking code existed in both tables, then main form and subform are linked automatically. When the code in main form is selected in unbound control (or for whatever other reason the link wasn't created automatically) , then you have to open properties of subform (NB! Of subform, not of source form of subform) and set manually properties for LinkMasterFields (primary key of main table, p.e. CustomerID or name of unbound control in main form) and LinkChildFields (the code field in your bookings table, p.e. CustomerID)

    Now, when you select a entry in main form (or select some code in unbound control on main form when you use this design), p.e. you select a customer in main form, in subform all bookings currently registered with this code are displayed. And when you enter a new booking into subform, this is automatically linked with main table (the code defined in LinkMasterFields property of subform is entered into code field of new booking you are registering).

    When this is not what you need, then you have to think more carefully how to explain what you need to do.

    When you want to enter data directly into tables, then forget about automation unless you are ready for some heavy code-writing. The simple way to enter data directly into 2 linked tables is to enter the data manually into both of them (foreign keys included), and to pray you didn't make any errors somewhere.

  5. #5
    tbjmobile@gmail.com is offline Competent Performer
    Windows 10 Access 2016
    Join Date
    Jan 2018
    Posts
    127
    Thank you, this will form the basis for what I want to do.

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

Similar Threads

  1. Replies: 6
    Last Post: 10-22-2022, 08:27 AM
  2. Replies: 9
    Last Post: 08-19-2015, 11:29 AM
  3. Replies: 7
    Last Post: 11-02-2012, 12:05 PM
  4. Replies: 3
    Last Post: 10-02-2012, 12:25 PM
  5. Data entry related records
    By illoquentgent in forum Programming
    Replies: 10
    Last Post: 05-02-2012, 10:43 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