Results 1 to 4 of 4
  1. #1
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110

    Update multi value listbox fields from subform


    Hello all,

    I have a form JobServices that has a multi value listbox, lboServiceChoice. On this form I also have a subform, JobServicesSub that is there to add new services if they are not already present in the multi value listbox. In JobServiceSub I have a textbox, tboAddService and a button, cmdAddService. I would like to be able to put a new service name into tboAddService and press cmdAddService and have that new service pop up in the list of services in lboServiceChoice already checked.

    I would like it to show inside the form checked so the user knows there choice has been added. They possibly could add more than just the one service while using the form.

    I have tried using,

    Code:
    Private Sub cmdNewService_Click()    
        DoCmd.GoToRecord , , acNext
        Forms![JobServices].Requery
    End Sub
    This is not doing the trick. There must be some way to actually get lboServiceChoice to requery that I'm not aware of.

    Please let me know if you have any suggestions for me to try.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    Me.lboServiceChoice.Requery

    Not understanding data structure and form/subform setup. What table is JobServices form bound to? What table is the RowSource for lboServiceChoice?
    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
    Stephenson is offline Competent Performer
    Windows 7 64bit Access 2013
    Join Date
    Sep 2015
    Location
    North West
    Posts
    110
    Thanks June7.

    I was able to get my form, JobServices to update using my button in JobServicesSub with,

    Code:
    Private Sub cmdNewService_Click()    
        DoCmd.GoToRecord , , acNext
        Forms![JobServices]![lboServiceChoice].Requery
    End Sub
    This adds the new value from the subforms textbox to the parents multi value listbox. It is however unchecked. If there isn't a way to make it come up automatically checked I can live with it. I just hate for the user to have to select something twice.

    The form JobService is bound to my JobBudget table using
    Code:
    SELECT JobBudget.*, ServiceChoice.Value FROM JobBudget;
    My subform JobServiceSub has table Service as it's record source. I've used the following for lboServiceChoice

    Code:
    SELECT [Service].[ID], [Service].[Service] FROM Service ORDER BY [ID];

    This is what I'm slowly attempting to do. The user will use this to setup bids for new jobs and print proposals.

    1. First is form, JobNamer. This lets the user name the new job or choose a job that they've already been working on. I have form JobNamer connected to table Jobs.

    2. Form JobService will have the user select all the services the new job will include in the bid. The title of the form shows the new job name from form JobNamer so they know they're in the right place.

    3. Next will be form BudgetBuilder. Here the Services will show one at a time in the order they are in lboServiceChoice. The user will select the pieces of equipment and labor type that will be used and the duration they will be needed as well as any outside resources. There will be subtotals to let them know where the budget stands. The user will be able to press a button to bring up the next service to fill in its details. This last form is still all in my head, but I'm excited to try to get it to work. I'm not sure where or how to record this to a table.

    My concern is table layout. I know I'll need to make adjustments to get this to flow.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,632
    I NEVER use multi-value fields. For the item to show checked, have to save the value to the multi-value field. Programmatically saving value to multi-value field is a bit complicated. Requires VBA to open and manipulate recordsets.
    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: 5
    Last Post: 02-14-2015, 04:11 AM
  2. Replies: 7
    Last Post: 11-24-2014, 02:11 PM
  3. Update Column from Multi-select listbox
    By jhargram in forum Forms
    Replies: 4
    Last Post: 02-27-2012, 12:03 PM
  4. Replies: 3
    Last Post: 06-22-2011, 08:51 AM
  5. Multi-select listbox and update flag in table
    By Suresh in forum Programming
    Replies: 0
    Last Post: 12-19-2007, 01:04 AM

Tags for this Thread

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