Lister
Z Shift
- Local time
- Today, 20:01
- Joined
- Aug 24, 2003
- Messages
- 305
Cascading ComboBox Subform Error.
Right I am stuck, and I hope someone out there can help.
I have a main form and a sub form. The subform is a form.
On this sub form, when I put the form together before linking/inserting onto the main form, I set up your classic Cascading Combo Box, select the Branch in the first Box and the lower combo box lists all the persons whom work there. Click Select No Problems at all.
Now when I linked/inserted this form into the main for as the subform and run the Main form. Everything works just as it should, EXCEPT I GET AN ERROR AND THE LOWER COMBO FAILS.
Thinking that it was my code I mucked around and around but got nowhere.
I knocked up a sample to see if it was me or something else and it’s got the same problem.
I have posted a screen shot of the error that I am getting.
I just don’t understand it works fine if you enter the correct value into the input box, and it works fine if you view just the subform, but as a subform, it falls over.
I am thinking that it’s the…
The SQL for the first box is...
And the second..
But I’m quite at a loss. I have the awful feeling that its going to be something stupidly simple.
If anyone could help out that would be great.
Thanks
Right I am stuck, and I hope someone out there can help.
I have a main form and a sub form. The subform is a form.
On this sub form, when I put the form together before linking/inserting onto the main form, I set up your classic Cascading Combo Box, select the Branch in the first Box and the lower combo box lists all the persons whom work there. Click Select No Problems at all.
Now when I linked/inserted this form into the main for as the subform and run the Main form. Everything works just as it should, EXCEPT I GET AN ERROR AND THE LOWER COMBO FAILS.
Thinking that it was my code I mucked around and around but got nowhere.
I knocked up a sample to see if it was me or something else and it’s got the same problem.
I have posted a screen shot of the error that I am getting.
I just don’t understand it works fine if you enter the correct value into the input box, and it works fine if you view just the subform, but as a subform, it falls over.
I am thinking that it’s the…
Code:
Private Sub cboBatch_AfterUpdate()
On Error GoTo Err_ErrorHandler
Me.Combo32.Requery
Exit_ErrorHandler:
Exit Sub
Err_ErrorHandler:
MsgBox Err.Discription, vbExclamation, "Error #" & Err.Number
Resume Exit_ErrorHandler
End Sub
The SQL for the first box is...
Code:
SELECT [tblParent].[ParentId], [tblParent].[Partent]
FROM tblParent ORDER BY [tblParent].[Partent];
And the second..
Code:
SELECT [tblChild].[ChildID], [tblChild].[Child], [tblChild].[ParentID]
FROM tblChild
WHERE [tblChild].[ParentID]=[Forms]![frmExample]![cboParent] ORDER BY [tblChild].[Child];
But I’m quite at a loss. I have the awful feeling that its going to be something stupidly simple.
If anyone could help out that would be great.
Thanks
Attachments
Last edited: