Using subform as a placeholder.

VegaLA

Registered User.
Local time
Today, 06:41
Joined
Jul 12, 2006
Messages
101
Hi all,
I have a subform control on my main form named subsubform
which is a subform also named subsubform. This subform has no controls on it, it is just a placeholder. The subform changes to one of three other subform depending on the button the user clicks so they can see three entirely different sets of data.
However ideally I’d like to have the placeholder display queries instead of subforms, so the placeholder changes from one completely different query to another when they click the button.
Like I say this works fine using different subforms but if I can use queries instead of subforms it would save me having to create various different subforms as the different queries already exist.

Is this idea worth the hassle? It just surprised me that I could not change the source of the placeholder to a query instead of a subform that is made from that query.

Hope that makes sense because it sounded off as I typed it.

Thanks in advance,
Mitch.....
 
I done something like that by reusing one list box. All I had to do was change the list box record source to the SQL string and also the column count # in the after update event of a combo box using a select case statement.
 
Thanks.
I think I understand what you mean.
I created a text box to hold the SQL string and then set the recordsource for the sub form as = forms!frmMain.txtbox.value then in the code for the button on that main form set the placeholder as the subform. The SQL is set to the textfield on the main form where the subform recordsource should read from, but ot doesn't seem to be working out that way.

Here is the code I have behind the main form button.

Dim strSQL as string

strSQL = "SELECT Field01 FROM tbl WHERE field 1 = value"

Me.txtSQLSrc = strSQL

Me.subsubForm.SourceObject = "subDelToCF"

End sub

and the code for the recordsource for the sub form is :-

=forms!frmMain.txtSQLSrc.value

I suspect I have too much happening at once?

Any help is greatly apreciated.

Mitch.....
 

Users who are viewing this thread

Back
Top Bottom