form in a form (#2)

  • Thread starter Thread starter Dion
  • Start date Start date
D

Dion

I am trying to do a subform. From a previous post (thank
you), I have the following:

I created a form "SQL_Frm" - this is used for my subform.
In my main form, I created a subform (Name="MySubFrm",
Source Object="SQL_Frm"). In my main form I also have a
command button, with the following event:

Sub cmdFindRecords_Click()
Dim uSQL As String
uSQL = "SELECT * FROM Charges2 WHERE Doctor = 'RITJO';"
Forms!SQL_Frm.RecordSource = uSQL
Me!MySubFrm.SourceObject = ""
Me!MySubFrm.SourceObject = "SQL_Frm"
End Sub

But this doesn't work. Ultimately, my uSQL string will be
built from other combo boxes on the main form.

I don't know what I am missing - Help?

Thanks
Dion
 
When you want to refer to a subform you need to use
Me!MySubFrm.Form.SourceObject You need to use the .Form property before
refering to controls and other properties.

Kelvin
 
I had a problem with creating subforms with my form
All I did was use the wizard, and it worked great
The only issue with using the wizard is that you need the right combination of tables to get the results. I had to try many times before I got what I wanted. Then you can put the button in afterwards. That worked for me.
 
Back
Top