Results 1 to 2 of 2
  1. #1
    Evetsllub is offline Novice
    Windows 7 Access 2007
    Join Date
    Jun 2010
    Posts
    1

    Update form when data collected from Listbox

    Hi, I hope someone can help me with what i hope is a relatively simple question.

    My coding etc skills are negative, i just find something on the interweb and try to make it fit, i have found something that almost lets me do what i want to do.

    I have a form. There is a combobox where each person selects their name. This filters into a List Box (linked to a query) which shows all the work in their pipeline. Now what i want is for them to click on the field in the List Box they are working on and this will populate data into the rest of the form. Some of the data is to then be edited by the person working on the field.



    This is all working, except it won't let me edit any of the fields in the form... its all to do with this expression I have in the fields, as it comes up with "Control can't be edited, its bound to the expression..."

    Now the expression is this:

    =IIf(IsNull(DLookUp("[Completed]","Work_Flow","[Plan Number]=" & [Forms]![Switchboard]!
    [List61])),"",DLookUp("[Completed]","Work_Flow","[Plan Number]=" & [Forms]![Switchboard]!
    [List61]))

    where "completed" is the field to be edited, "Work_Flow" is the table the data sits in, "Plan Number" is the specific record number of the data being worked on, "List61" is the List Box that is feeding into this and "Switchboard" is the form.

    I have also tried moving this expression to the "AfterUpdate" Event on the Listbox through VBA. This doesn't throw the error message, however anything i edit wont update the underlying table and when i click off & Back on it is back to what it was.

    Can i amend this expression so that the data can be edited???

  2. #2
    llkhoutx is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Jan 2010
    Location
    Houston, Texas USA
    Posts
    373
    You cannot reference a listbox row that way. You must use VBA to cycle through the listbox and determine which row, if any, is selected. Then in VBA calculate to desired value and store it on the form. It can then be updated, provided that your form recordset is updateable.

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

Similar Threads

  1. Replies: 3
    Last Post: 10-30-2013, 11:42 AM
  2. Replies: 3
    Last Post: 04-14-2010, 10:00 AM
  3. Replies: 6
    Last Post: 03-27-2010, 11:18 AM
  4. Replies: 1
    Last Post: 04-09-2009, 09:18 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

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