Page 1 of 2 12 LastLast
Results 1 to 15 of 30
  1. #1
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398

    Selecting records within a form


    I'm creating a form that contains a combo box using an ODBC connected table that contains purchase orders. The user selects the desired purchase order. Once the purchase order is selected, I need to display the purchase order items that are a part of this purchase order. The purchase order items are located in a different table. Once all the purchase order items are displayed, I need for the user to select some or all of the items, and these are written to another file. Thanks for your help!

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    It sounds like your PurchaseOrders and the PurchaseOrderItems have a 1:m relationship which is best delt with in a Form/SubForm arrangement with the many side bound to the SubForm in continuous form mode.

  3. #3
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    OK. So I create a main form with the combo box to select the purchase order numbers, then a subform will display the purchase order items linked to the main form's purchase order. How do I have the user to select specific purchase order items and add them to a new file?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    A useful interface is using two ListBoxes and < & > arrows to move the records.

  5. #5
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    I can't seem to make any progress on this. The subform does not recognize the combo box for the relationship between the main form and subform. So let me make sure you know what my needs are, and what my tables are.
    From the ODBC connection:
    ICPurchaseOrder - contains the purchase order number
    ICPOLineItems - contains the line items within the po, linked by the po number from the table ICPurchaseOrder
    Since both of these tables are from an ODBC connection, I'm unable to add any fields to either of these tables.

    Within the DB I've created:
    tblProductPrintRunRecord - contains the following fields. PrintRunID, Series#, PrintRunDate
    Each line item within ICPOLineItems needs to have a record within tblProductPrintRunRecord, each field containing data.

    The PrintRunID will have a PO# associated with it, and thus the ICPOLineItems associated also. A PO# can also be associated with multiple PrintRunID's. a ICPOLineItem will only be associated with 1 PrintRunID

    What are you suggestions?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    The LinkChild/MasterFields can point to either controls on the respective form or fields in the RecordSources of each respective form. I would start by getting that part of the form working.

  7. #7
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    So I create a form using the recordsource of tblProductPrintRunRecord. The user enters the PrintRunID, and I have a combo box displaying the records within ICPurchaseOrder. The user selects a PONumber. My subform will contain the appropriate records from ICPOLineItems with the link between the PO numbers between those 2 tables?

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    I would think the RecordSource of the MainForm would be ICPurchaseOrder and the SubForm RecordSource would be ICPOLineItems.

  9. #9
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thanks. I'll start in that direction. Where in CO are you located?

  10. #10
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Four Corners area, Pagosa Springs. Post back here if you need further suggestions.

  11. #11
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thanks. I passed through their last week. Beautiful country!!

  12. #12
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    In linking the main form to the sub form, how do I utilize the combo box as the link on the main form to a field on the subform? When I try to create the link, the combo box is not listed, only the fields within the table are listed.

  13. #13
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows 7 64bit Access 2010 32bit
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Use the ComboBox wizard and select option #3 and just move to the record you want. The cbo is not directly involved in the linking at all.

  14. #14
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    Thank you!! That all worked. My last question is within this form, if I select a PO, all the POLineItems will be displayed. Let's say their are 5 line items on this PO. For 4 of them I enter a PrintRunID. If I save this PrintRunID, I will refresh the screen to remove all the data. If the user then enters the same PO, I should only have the 1 remaining line item to appear. How do I do that?

  15. #15
    crowegreg is offline Competent Performer
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Posts
    398
    On the subform I added a checkbox field for the user to select this line item to be included within this print run. Now, I'm writing the VBA to add the new record to the printrun table. How do I loop through the records on the subform to only create records for the items that have been checked?

Page 1 of 2 12 LastLast
Please reply to this thread with any new information or opinions.

Similar Threads

  1. selecting Sub-Form data from two inputs
    By techexpressinc in forum Queries
    Replies: 19
    Last Post: 12-03-2010, 11:03 AM
  2. Replies: 5
    Last Post: 04-01-2010, 03:48 PM
  3. Selecting multiple records in drop down
    By rscott7706 in forum Access
    Replies: 1
    Last Post: 08-26-2009, 03:00 PM
  4. Problem Selecting Records for a Report
    By Joe in forum Programming
    Replies: 0
    Last Post: 09-27-2008, 02:27 PM
  5. Replies: 1
    Last Post: 03-17-2006, 12:04 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