How do I change the record on a main form when I click on a record in the subform

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • scootaman
    New Member
    • Feb 2010
    • 22

    How do I change the record on a main form when I click on a record in the subform

    I have a main form for adding or changing events called Trianing Events Details. On that form there is a subform that is tied to the Start Date field of the main form. I have the form setup this way to mimic a day view in a calendar. I would like to be able to click on a start time of a record in the subform and have it show in the main form. I expect a day may come when I intering an event I may need to change the start time of one of the other events to acamodatea a conflict in resources.

    I don't know how to write this in VBA as an On Click event. I've looked at several examples on the net but they all seem to be for changing subforms rather than the main form.

    Thanks
  • scootaman
    New Member
    • Feb 2010
    • 22

    #2
    Well I found an easyer solution for now. I used a list box with and a macro.

    Comment

    • scootaman
      New Member
      • Feb 2010
      • 22

      #3
      Opps, I spoke to soon, the List box doesn't do what I want. I am using the Calendar made by ADezii. When I click on a day in the calendar my form Training Events Details opens to a new record and automatically inserts the Start Date for the day that is Dbl Clicked on the calendar. The subform I had will show all the events for that day event when it is a new record. The list box will not work the same. If I open the form to a new record through the calendar my list box is empty. I it will work only if I open the form to a specific record. Using the subform I don't have this problem.

      However, I still don't know how to program the subform to change the filter of the main form.

      Comment

      • scootaman
        New Member
        • Feb 2010
        • 22

        #4
        Update. I got the list box working the way I need to. I added

        Code:
        Forms![training events details]![List34].Requery
        In the On Current event right after the code that automatically inserts the date for the day on the calender I click. My list box now shows all the events for the current day just like I wanted it to. This works much easier than trying to work backwards by using the subform.

        I have a long way to go in learning VBA

        Comment

        Working...