I can Not Change the RowSource Propeety of a ListBox.
Main Form = frmSchedule - Unbound
SubForm = sfrmDayView - Unbound
ListBox = lstDay - Unbound - RowSorceType = Table/Query
The code:
strlstDayFill = "SELECT tbl.Time.TimeConverted FROM tblTime"
With Forms!frmSchedule!sfrmDayView!lstDay
.RowSource = strlstDayFill
.Requery
End With
is called from a Public Function in a ClassModule called DateAssign(). This function is called when frmSchedule open event.
The ListBox will not Fill with the strlstDayFill Query. There is a TextBox, txtDay, on sfrmDayView that gets Filled when the code, Forms!frmSchedule!sfrmDayView!txtDay = varDateSelected, runs from the Public Function DateAssign().
If I name/save the query as Query3 and select this in the ListBox RowSource it Works. If I put the above in the Open event of sfrmDayView it Works.
Why cant I set the RowSource Property from a Parent form for the ListBox located on a SubForm.
I need the code to be in the Public Function because I will be making the query much more complex and it will need to use variables within the Public Function DateSssign()
Thank you in advance for your help.
Main Form = frmSchedule - Unbound
SubForm = sfrmDayView - Unbound
ListBox = lstDay - Unbound - RowSorceType = Table/Query
The code:
strlstDayFill = "SELECT tbl.Time.TimeConverted FROM tblTime"
With Forms!frmSchedule!sfrmDayView!lstDay
.RowSource = strlstDayFill
.Requery
End With
is called from a Public Function in a ClassModule called DateAssign(). This function is called when frmSchedule open event.
The ListBox will not Fill with the strlstDayFill Query. There is a TextBox, txtDay, on sfrmDayView that gets Filled when the code, Forms!frmSchedule!sfrmDayView!txtDay = varDateSelected, runs from the Public Function DateAssign().
If I name/save the query as Query3 and select this in the ListBox RowSource it Works. If I put the above in the Open event of sfrmDayView it Works.
Why cant I set the RowSource Property from a Parent form for the ListBox located on a SubForm.
I need the code to be in the Public Function because I will be making the query much more complex and it will need to use variables within the Public Function DateSssign()
Thank you in advance for your help.