Results 1 to 4 of 4
  1. #1
    RoundTrip is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    28

    Bringing Table Information Into a Subform


    Hello everyone, I hope everyone is having a wonderful V-Day!
    Anyways I have a question about Subforms, and how to utilize it to work in a way I see it in my head!

    I have A form where I enter information as follows in order as well
    {Report Number, Date, Location, Equipment No., Field No, Crop, Operator, and then WorkOrder Number}
    Now when I type in the WorkOrder Number, I am wanting to go into detail of what was used on that WorkOrder. So I will be using a Subform below the Workorder label. Now I have a seperate table for the information that will go in the subform and the fields that will be used in that subform is as follows
    {Product(s),Amount Used}
    So Basically what I am saying is, I want to be able to type in a Workorder Number, And then when I enter my information in the subform for those two fields (Products and amount used) then no matter how many records I do in that subform it automatically saves it to that certain workorder number.

    Now another question regarding this, does this mean I would have to set WorkorderNumber as a primary key or foreign key or what would my steps be here? Thankyou very much for the help
    Last edited by RoundTrip; 02-15-2014 at 08:57 PM.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    That's what form/subform arrangement is intended for. Set the subform container control Master/Child Links properties to the primary and foreign key fields and the value will automatically save to the related child record.

    Whatever the primary key is in the WorkOrder table should be the value saved to child record as foreign key. If WorkOrderNumber is not the primary key then there is no reason to save to child record.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  3. #3
    RoundTrip is offline Novice
    Windows 7 64bit Access 2010 64bit
    Join Date
    Feb 2014
    Posts
    28
    I have it figured out now except one minor problem, If I want to keep the workorder record blank for any odd reason, like if we did not use any products at that time then how can I make it where it does not pop up with a window saying
    Index or primary key cannot contain a null value
    Last edited by RoundTrip; 02-15-2014 at 03:15 PM.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,929
    That error should only happen if a record on the main form is initiated by data entry into a field and only if you have a non-autonumber field set as primary key. Did you set the WorkOrderNumber as primary key? Can press ESC key to undo edits.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Replies: 1
    Last Post: 05-31-2013, 11:02 AM
  2. Replies: 1
    Last Post: 03-22-2013, 03:33 AM
  3. Replies: 3
    Last Post: 02-24-2013, 02:32 PM
  4. Replies: 1
    Last Post: 04-10-2012, 04:21 PM
  5. Replies: 4
    Last Post: 01-03-2011, 10:54 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