Results 1 to 5 of 5
  1. #1
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1

    Unanswered: List Box and Force Save

    I have a form of sailing school courses (an unbound form), with a list box of sessions (date, start and finish time, and instructor). I have a related (bound) form to permit changes to the sessions. This latter form has a pull down combobox of all available instructors. However, when I make a change to the instructor in the sessions form and return to the course form, the list box of sessions is not updated in the course form. It appears that the updating problem is ONLY with the instructor. If I go out and return to the course form, the sessions list box (instructor) is updated..

    The session list box in the Course form is loaded as a row source in the form_0pen event thus:

    Dim aSQL1 As String

    aSQL1 = "SELECT asession.ID, asession.adate, asession.aStart, asession.aFinish, [prenom] & ' ' & [nom] AS empName"
    aSQL1 = aSQL1 + " FROM asession INNER JOIN employees ON asession.instructeur1 = employees.ID "
    aSQL1 = aSQL1 + "WHERE asession.aCourse = " & aCourse ' [[established by me.openargs]]

    lstSession.RowSource = aSQL1

    I have tried everything I know and some things I didn't to force a save without success. Any ideas?


    John S
    Aylmer, Quebec

  2. #2
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    Listbox and combobox controls are not dynamic, i.e. they do not refesh their data automatically once they are loaded. You need to use the Requery method of the object to force it to reload its data from the table or query it uses as its RowSource property:
    Code:
    Me.ControlName.Requery
    Where ControlName is the name of the control (Listbox or ComboBox).
    Have a nice day!

  3. #3
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1
    Appreciate the reply, but unfortunately didn't work. Been trying everything to force a save, or clean out the cache, or refresh or requery.Might actually try to throw in a pause. Probably is something so incredibly stupid.... Probably dawn on me at 3:00 AM.

    Thanks again,

    John S

  4. #4
    Join Date
    Mar 2009
    Posts
    5,442
    Provided Answers: 14
    1. Is the new or changed data actually saved to the table?
    2. Does the new or changed data match the criteria used in the RowSource property of the control?
    Have a nice day!

  5. #5
    Join Date
    Mar 2009
    Location
    Gatineau, Quebec Canada
    Posts
    147
    Provided Answers: 1
    Hi,

    Yep, it is saved to the sessions table.

    The data does appear to match.

    I rather suspect some weird timing issue.

    The course form is reopened ("Docmd.openform....") before the sessions form is closed (DoCmd.Close....). The sessions form is also bound to the sessions table (I suspect that bound is a problem, especially when reloading the sessions list (via the rowsource property) in the form_open event of the course table.

    I suspect I will have to install a manual update ("Docmd.runSQL("Update.......). Will try it, and let you know if the problem persists. Another defeat for sloth!

    Regards


    John S

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •