Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem Setting RowSource Property on SubForm

Status
Not open for further replies.

tfayer

Technical User
Aug 4, 2002
41
US
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.
 
if you want to refer to a subform you do it like this

forms!formname.form!subformname!listboxname.properties "What a wonderfull world" - Louis armstrong
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top