Results 1 to 6 of 6
  1. #1
    MikeMairangi is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2011
    Posts
    12

    Returning PK after append?

    I want to append CUSTORDER table that has a seperate ORDERLINE table and I am having issues doing this. If I create a new CUSTORDER I need to obtain the CUSTORDER.ID in order to add records to ORDERLINE. I have added the relationship diagram for this which I think is correct, but doubting it now as I would need to return the PK FROM custorder to add ORDERLINE and this is the problem!!



    Any help would be much appreciated

    Cheers from a very cold New Zealand

    Mike

  2. #2
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Not understanding the issue. Are you using form/subform arrangements? Main form bound to CustOrder, subform bound to OrderLine. Master/Child linking will synchronize the data. Start a new CustOrder record and OrderLine records will automatically record the CustOrder ID when data entered in subform.
    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
    MikeMairangi is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2011
    Posts
    12
    I added a button that created a new CustOrder and then Opened a form that I wanted to add Orderlines to. When doing this I needed to identify the CustOrder PK that had been created in order to add the OrderLines but couldn't get this to return the value correctly, i.e. I had no unique criteria to select it. I'll add a Form and SubForm bound in line with your response and see if I can get this to work.

    Many thanks for your assistance it is much appreciated!!

    Cheers

    Mike

  4. #4
    MikeMairangi is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2011
    Posts
    12
    I've changed the source for the main form to CustOrder and created a subform bound to OrderLines but I'm stuck now as to how I go about creating an order. i.e. what's next!! Sorry I'm sure this is simple but the problem is so am I

  5. #5
    June7's Avatar
    June7 is online now VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,956
    Controls (text, combo, list boxes) on forms bound (set ControlSource property) to fields of respective RecordSource. Data entered into controls is entered directly to table. Records commit to table when form closes or move to new record or code is run to save 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.

  6. #6
    MikeMairangi is offline Novice
    Windows 7 32bit Access 2007
    Join Date
    Aug 2011
    Posts
    12
    Thank you so much. After a far bit of head scratching it is now working! Really appreciate your help and have a great weekend

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

Similar Threads

  1. Queries not returning data
    By Verso in forum Queries
    Replies: 1
    Last Post: 08-11-2011, 01:46 AM
  2. Replies: 7
    Last Post: 07-21-2011, 01:01 PM
  3. Query - Returning ID instead of Value...??
    By Poolio in forum Queries
    Replies: 5
    Last Post: 04-18-2011, 07:10 AM
  4. Returning only the last number in a field
    By stanley721 in forum Queries
    Replies: 6
    Last Post: 03-07-2011, 10:37 AM
  5. Append query won't append
    By yelkenli in forum Queries
    Replies: 5
    Last Post: 02-12-2010, 11:19 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