Setting control source after running subform

steve1111

Registered User.
Local time
Today, 00:17
Joined
Jul 9, 2013
Messages
170
Hello,

I have a form that has five subforms on it. On Open all the subforms are unbound (so i can prevent the queries from running before the On Open event to speed up). Then i can enter my criteria for all five subforms in txtbox and click run. After I establish the source object for the subforms, i cannot establish the controlsource for several text boxes that pull the data from the subform, i get #Name?. her is a sample from the on click event... the top links the unbound subform and the bottom should then link a control in the subform to a control on the main form.

Me.Child167.SourceObject = "query.RP Sum Fuelman F1"
Me.Text71.ControlSource = "=[RP Sum Fuelman F1 Subform]![cntRecords]"
 
Me.Child167.SourceObject = "query.RP Sum Fuelman F1"
not sure if it is causeing the problem, but you shouldn't use '.' in object names

Me.Text71.ControlSource = "=[RP Sum Fuelman F1 Subform]![cntRecords]"
This should be more like

Code:
Me.Text71.ControlSource = me.[RP Sum Fuelman F1 Subform].form.cntRecords]
where [RP Sum Fuelman F1 Subform] is the name of your subform control.

Using spaces, although 'allowed' they are a personal choice which can make debugging difficult so this may also be causing you issues if you have missed off the square brackets somewhere
 

Users who are viewing this thread

Back
Top Bottom