How do I change the record source of a subform

cliftonx

Registered User.
Local time
Today, 16:55
Joined
Mar 4, 2010
Messages
27
I'm trying to change the record source of a subform. I'm getting for following error:

1657307256047.png


The following is the code I use to generate the error:

1657307357525.png
 
Maybe you could try it this way instead?
Code:
Forms!frmiimain.frmDevsWithPartSpecs.Form.Recordset = rst
(untested)

PS. I think the error message simply means you're using a dot notation outside of your With block. In other words, you already had the End With line before the line with .sql in it.
 
Maybe you could try it this way instead?
Code:
Forms!frmiimain.frmDevsWithPartSpecs.Form.Recordset = rst
(untested)

PS. I think the error message simply means you're using a dot notation outside of your With block. In other words, you already had the End With line before the line with .sql in it.
I tried the above code and now I get the following error:
1657308947415.png


Here is the new code:
1657309151215.png
 
Can't you just qualify the sql with qdfpass ?
Qdfpass.sql
 
You may need to use Set....
Code:
Set Forms!frmiimain.frmDevsWithPartSpecs.Form.Recordset = rst
... to do an assignment with an object type.
 
Maybe you could try it this way instead?
Code:
Forms!frmiimain.frmDevsWithPartSpecs.Form.Recordset = rst
(untested)

PS. I think the error message simply means you're using a dot notation outside of your With block. In other words, you already had the End With line before the line with .sql in it.
Thank you. That solved the problem. I was using the dot notation outside the With block.
 
Thank you. That solved the problem. I was using the dot notation outside the With block.
Hi. Glad to hear you got it sorted out. Good luck with your project.
 

Users who are viewing this thread

Back
Top Bottom