Results 1 to 3 of 3
  1. #1
    shira47 is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Jun 2012
    Posts
    2

    Lock in value in header field in continuous form

    I'm a total access newbie, it seems like this issue should be easy to solve, but I've been googling all day and can't
    figure it out. Please tell me if the question here isn't clear...

    I have a continuous form with one field located in the header called PN (Part Number) and a few fields in the detail section of the form that are related to processes/parameters. The form is based on a parameter query and opens to one part number at a time (and there is no reason an employee would be working on two part numbers at a time)

    The problem I'm having is every time a new entry is made in the detail section of the form, the PN disappears from the header and the PN is not recorded in the related table...is there any way to lock this information in so it always shows in the form and always gets recorded
    in the related table. I thought putting it in the header and not in the detail section would make it consistent...

    Thanks in advance

  2. #2
    John_G is offline VIP
    Windows XP Access 2003
    Join Date
    Oct 2011
    Location
    Ottawa, ON (area)
    Posts
    2,615
    What's happening is that the PN in the header, and the fields on the detail section are all bound to fields in the same underlying table, and more importantly, to the same record in that table. So, when you add a new record in the detail section, the header control moves to the new record as well, and is of course blank. You can do what you want to do, but it will require a bit of VBA code.

    Are you familiar with VBA at all?

    John

  3. #3
    Missinglinq's Avatar
    Missinglinq is online now VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    What you're describing here sounds like the classic one-to-many scenario, with the 'one' side being the PartNumber and the 'many' side being the Detail Fields. This is usually handled with a Main Form/Subform set up.

    In general terms the Main Form would be a Single View Form and based on a PartNumber Table. The Subform would be, as you’re currently doing, displayed as a Continuous View Form (to better display the 'Detail Fields') based on a Detail Fields Table.

    The Fields would typically be something like this:

    PartNumberTable
    PartNumberID 'Primary Key
    PartNumberName
    ...and so forth

    Detail Fields Table
    PartNumberID 'Foreign Key
    Detail FieldID 'Primary Key
    DetailField1
    DetailField2
    ..and so forth

    Once you've designed your Main Form and Detail Fields Form, based on PartNumberTable and Detail FieldsTable, respectively, open the Main Form in Form Design View and add a Subform Control to it. The Subform Wizard will walk you through the process. When asked, base your Subform on the DetailFields Form. Seeing that both Tables the Forms are based on have a Field named PartNumberID, the Wizard should ask if you want to link the Main Form /Subform using these Fields. Answer OK and Bob's your uncle!

    As you move through the PartNumber Records in the Main Form, Access will automatically update the Detail Fields Records in the Subform and only show those Detail Fields related to that Area.

    And when you add a New Detail Record, the PartNumberID from the Main Form will automatically be entered in the related Detail Record.

    None of this requires VBA coding, as all the 'heavy lifting' is done by the Access Gnomes by way of the Subform Wizard.

    Good luck with your project!

    Linq ;0)>
    The problem with making anything foolproof...is that fools are so darn ingenious!

    All posts/responses based on Access 2003/2007

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

Similar Threads

  1. HELP! Set Focus to Continuous Sub Form Field
    By asmith78 in forum Programming
    Replies: 1
    Last Post: 09-09-2011, 02:27 PM
  2. Replies: 12
    Last Post: 06-10-2011, 10:19 PM
  3. Replies: 4
    Last Post: 01-23-2011, 09:01 PM
  4. Calculated Field in continuous form
    By doobybug in forum Forms
    Replies: 2
    Last Post: 11-15-2009, 08:54 AM
  5. Replies: 2
    Last Post: 05-22-2009, 01:07 PM

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