changing the sourceobject of subform when the form and subform are loaded 
Author Message
 changing the sourceobject of subform when the form and subform are loaded

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



Sat, 05 Aug 2000 03:00:00 GMT  
 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



Sat, 05 Aug 2000 03:00:00 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. navigating for keyboard users - subfrom to form - subform to subform

2. Changing subform load order

3. Referencing a field on a SubForm within a Subform

4. Control name of subform from code behind subform

5. Question about the SubForm Object to help reference a subform

6. Subform refresh moves last record to top of subform

7. tabbing from subform to subform

8. tabbing from subform to subform

9. Moving from a sub-subform to a subform in Access 2.0

10. Cancel changes in form w/subform

11. Want to add record with form when subform field is changed

12. Form Question - Stepping Through Subform Records on Master Form

 

 
Powered by phpBB® Forum Software