How to use a listbox inside a subform to move through subform records

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • matt753
    New Member
    • May 2010
    • 91

    How to use a listbox inside a subform to move through subform records

    I have a subform that holds a bunch of records for employees. Rather than manually scrolling through I want to be able to click on one and then the subform displays that record.

    I tried
    Code:
    DoCmd.GoToRecord acForm, "frmsubEmployees", acGoTo, lstEmployees.Value
    Which works fine if you have the subform open in its own window by itself. But if it is inside "frmAdministrat ion" I get an error: "Run time error 2489, the object "frmsubEmployee s" is not open"

    If it matters, the subform inside "frmAdministrat ion" is called "frmsubAdminEdi t", then the SourceObject is changed to select the "frmsubEmployee s". There is also a few other subforms that show up in "frmsubAdminEdi t"
  • FishVal
    Recognized Expert Specialist
    • Jun 2007
    • 2656

    #2
    Try to manipulate with frmsubEmployees Recordset using FindFirst or Seek methods. Like the following

    <frmAdministrat ion ref>.frmsubAdmi nEdit.Form.Reco rdset.FindFirst ...
    or
    <frmAdministrat ion ref>.frmsubAdmi nEdit.Form.Reco rdset.Seek ...

    Comment

    • matt753
      New Member
      • May 2010
      • 91

      #3
      Shouldnt this be able to be done just with the DoCmd.GoToRecor d?

      What other code is required for doing it the recordset way?

      Comment

      Working...