SetFocus error on subform

ChristopherM

Registered User.
Local time
Today, 18:36
Joined
Jan 5, 2000
Messages
38
I have a subform whose recordsource I set by clicking a button on the main form which runs the following code:

Me.MfrStockSubForm.Form.RecordSource = "MfrUnlinkedStockQuery"
Me.MfrStockSubForm.Requery
Me.MfrStockSubForm!LinkButton.Visible = True
Me.MfrStockSubForm.Enabled = True
Me.MfrStockSubForm.SetFocus
Me.MfrStockSubForm!LinkButton.SetFocus

The recordsource works ok because I can see the resulting records in the stockform. And the LinkButton becomes visible. However the code generates a run-time error 2110 " ... can't move focus to the control MfrStockSubForm" on the second last line of code. The subform itself is set to "Continuous Forms" and the recordset to Dynaset. Even if I comment out this part of the code, I cannot click on the subform or scroll down to see the rest of the records. I wonder if this is anything to do with the subform not being linked because in design view the record source is blank?

Can anyone suggest any ideas I can pursue? I'd be grateful for any help.
 

Users who are viewing this thread

Back
Top Bottom