Jan 15 2007, 11:30 PM
I have a form in my database named frmMain that has custom tabs at the top of the form and a subform named MainSub at the bottom(has no SourceObject).
When a user selects one of the tabs it changes the SourceObject of MainSub to a certain form for example Me.MainSub.SourceObject = "frmAuditInfo".
The form "frmAuditInfo" has a combo box named cboProduct, when a user selects a product from the list it narrows the results in another combo box named cboReasons. I do this through a query.
The problem is in my criteria. I've tried [Forms]![frmAuditInfo]![cboProduct] but that only works if the actual form itself is open. I don't know how I'd write the criteria for this. I've also tried
Can anyone help me out with this? I hope its not too confusing.
Jan 15 2007, 11:37 PM
Try it like this...
Or, as some would prefer it...
Jan 15 2007, 11:42 PM
Steve Thanks for the reply. I tried both and still get the Enter Parameter. Their is still another form "frmAuditInfo"
Jan 16 2007, 12:22 AM
As I understand it, the frmAuditInfo form is the form that is accessed via the subform's Source Object property. If so, it doesn't come into the equation. The object referenced in the query criteria is the subform control, which is still named MainSub regardless of the form it houses. So, I don't know... should be right. What parameter specifically does the Enter Parameter prompt ask you for?
Jan 16 2007, 12:25 AM
Are you absolutely certain that the name of the combobox is cboProduct?
Jan 16 2007, 01:16 PM
The name of the cbo box is right, but the the name I gave you for the Subform was wrong. I was thinking it was MainSub, but it was SubMain. But the code did the trick.
Thanks for your help!
Jan 16 2007, 01:44 PM
Thanks for letting us know. I am happy to see it's working for you now.
Jan 23 2007, 01:58 PM
Steve I have another issue that is very similar.
When I first open my Main form the SubMain's Source Object is set to "login"
(ex. Me.SubMain.SourceObject = "Login")
This login form has a combo box for user name and a text box for password which the user will fill out. I'm using DLookup to look up the values in another table to make sure the values match then i want it to switch the SubMain.SourceObject to Me.SubMain.SourceObject = "frmAuditInfo"
Here is what I have and is not working: It errors out on the Me.SubMain.SourceObject = "frmAuditInfo" saying "Data member not found. And highlights SubMain:
If IsNull(Me.txtPassword + Me.cboUserName) Then
MsgBox "Username and password both needed"
ElseIf Me.txtPassword = DLookup("[password]", "users", "[username]='" & Me.cboUserName & "'") Then
Me.SubMain.SourceObject = "frmAuditInfo"
MsgBox "Username or Password Incorrect."
Jan 23 2007, 02:32 PM
Got it figured out with this
Forms!Main!SubMain.SourceObject = "frmAuditInfo"
If anyone else is having problems with this this web page
Jan 23 2007, 05:24 PM
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here