Results 1 to 9 of 9
  1. #1
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102

    Combo boxes to add items to a record on a subform???

    I am working on an inventory control db and I am stuck on a form that will allow me to assign equipment to an employee on a subform.



    I have a form (frmAssign) with a combo box that allows me to choose a name from a list of employees. when selected, that employee's list of assigned items appears on a subform (subAssign). THAT part works great. what I would like to do next is to have 2 cascading combo boxes that would allow me to choose a category (shirts, pants, etc) and then a size to add to a specific employee's list, then input a quantity, click a button, and that item would be added to the existing list on the subform.

    Thanks to an earlier post on this forum, I have the combo boxes worked out (on the form, not the sub) and the record-retrieval portion works fine, but I am stuck on how I would get the cascading combos to add additional records to the list.

    I have attached the db to this post, and would appreciate any help I can get.

    ThanksALSEWorking.zip

  2. #2
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    Data is stored in tables. When a user changes the value of a control on a form, they can commit changes by saving, navigating to another record, or closing the form.

    Perhaps it is as simple as saving the record from the Main Form. A subform with the proper Master/Child link properties should reflect any changes/updates.
    Code:
    If me.dirty = true then
    me.dirty = false
    end if

  3. #3
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    Understood, but what I am unable to wrap my head around is how do I specify that the next record on the list gets it's input from the 2 cascading combo boxes and the quantity control.

    the control source for the controls on the sub form reads the list of assigned items from the query related to the sub form. I am wanting the next/new/blank record to get the item info from what is selected in combo boxes and entered in the quantity field on the main form. (I am probably not doing a very good job of explaining this, sorry, I am a noob)

  4. #4
    Bob Fitz's Avatar
    Bob Fitz is offline Access Developer
    Windows 7 32bit Access 2013
    Join Date
    May 2011
    Location
    Essex UK
    Posts
    3,614
    Perhaps the data should be entered directly into the sub form rather than in the main form.
    If this helped, please click the star at the bottom left of this posting and add to my reputation . Many thanks.
    Bob Fitzpatrick

  5. #5
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    I had originally designed the sub form with the cascading combo boxes in the header, but couldn't get that to work... can't remember exactly what the error was, but it had something to do with the afterUpdate() event not being able to requery the first combo box.

    I will put whatever controls wherever they need to be in order for them to work the way I am wanting them to.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    If this is a form/subform arrangement and each form is bound to different dataset, why would data entered on main form need to be in subform record?

    If you want to provide db for analysis, follow instructions at bottom of my post.
    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.

  7. #7
    sprtrmp is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    Greenville, SC
    Posts
    102
    thanks for taking a look

    the db is attached to the original post

  8. #8
    ItsMe's Avatar
    ItsMe is offline Sometimes Helpful
    Windows 8 Access 2013
    Join Date
    Aug 2013
    Posts
    7,862
    It is likely you will need to use code behind an unbound ComboBox control to perform an append action.

  9. #9
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,770
    Sorry, missed the db in post. The two unbound comboboxes could be in the subform. Bind the product combobox to field. However, dependent comboboxes with lookup alias don't work nicely in continuous or datasheet form. One way to deal with is to include tblProducts in the subform RecordSource with RIGHT JOIN. Then display the related product info by binding textboxes to tblProducts fields but don't allow edits, set them as Locked Yes.

    Otherwise, as ItsMe advised, will need code to populate record 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.

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

Similar Threads

  1. Filter subform with two combo boxes
    By dotcanada in forum Forms
    Replies: 4
    Last Post: 07-25-2015, 05:20 PM
  2. Subform and combo boxes
    By paramesium in forum Forms
    Replies: 5
    Last Post: 02-17-2014, 03:35 AM
  3. Subform linking 2 combo boxes does not work
    By bishop0071 in forum Forms
    Replies: 9
    Last Post: 04-15-2013, 10:40 AM
  4. Replies: 14
    Last Post: 02-09-2012, 08:33 AM
  5. Replies: 2
    Last Post: 05-11-2011, 02:58 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