
changing the sourceobject of subform when the form and subform are loaded
Try using an option button instead. You could set your code for the OnClick
event for the option button to:
Sub optionOnClick
If optionbutton.value = -1 then
Forms!formname.recordsource ="Your sql"
Else
Forms!formname.recordsource ="Your state before sql"
Then go on to conduct your requery.
--
S.E. Hanley
Applications Programmer
Callaway Gardens
Pine Mtn. GA
Quote:
> I want to change the sourceobject of a subform using a command
> buttun.Actually I change the SQL statement that
> subform is based this is what I have done:
> db.QueryDefs("qrySubInvoice").SQL = "SELECT * WHERE
> tblTreatment.InvoiceNo =0"
> Me!frmSubInvoice.SourceObject = "frmSubInvoice"
> Me!frmSubInvoice.Requery
> but After changing the sourceobject of the subform , I want back to first
> state , I mean I want have subform with same sourceobject that I had
> before, first and simple thing is do the same for subform with what I had
> mention above.
> But it doesnt work. I dont know what should I do.
> Thank you ,
> Blessing
> Babak khorram