Referring to a field in a subform

Richard1941

Registered User.
Local time
Today, 13:20
Joined
Oct 29, 2012
Messages
34
I'm trying to use cascading combo boxes, where the second box is on a subform. I've found several examples of code to put on the first box after update action that require setting the record source for the second box. However, every structure I've tried for referring to the second box fails with a compile error unable to find the control. Here is the current code:

Private Sub ServiceRequested_AfterUpdate()
Dim strSQL As String
strSQL = "SELECT " & Me!ServiceRequested & " FROM LUtblMemberServiceCategories"
[tblRequestVolunteers subform.Volunteer].RowSourceType = "Table/Query"
[tblRequestVolunteers subform.Volunteer].RowSource = strSQL

End Sub

It fails on the line that sets the row source type.

Suggestions?
 
I changed the first tblRequest line to:

Me![tblRequestVolunteers subform].Form.RowSourceType = "Table/Query"

Now I get the following error message: Application defined or object defined error.

What now?
 
I'm not sure that this line in your code is required;
Code:
Me![tblRequestVolunteers subform].Form.RowSourceType = "Table/Query"

It's certainly not used in this example
 
Doesn't matter. I took it out and got the same error message on the next line.
 
A Form does not have a RowSourceType property.

Aren’t you missing the name of the combo box after the Form?

Chris.
 
A Form does not have a RowSourceType property.

Aren’t you missing the name of the combo box after the Form?

Chris.

Doh !!!!

aniunder.gif
 
You're right, of course. I changed the offending statement to:

Me![tblRequestVolunteers subform].Form!Volunteer.RowSource = strSQL

Now the error message says "Object doesn't support this property or method."

Still stymied.
 
Is Volunteer the name of the combo box or the field it is bound to?

Chris.
 
Please upload a small demo of the problem in Access 2003.

Chris.
 
Well, I can offer no further assistance.

Chris.
 
Thanks for your help, but I solved the problem by renaming the subform without the space so I would not need the brackets in the expression.
 

Users who are viewing this thread

Back
Top Bottom