Quicksilver2002
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
[Forms]![frmMain]![MainSub][frmAuditInfo].[form].[cboProduct].
Can anyone help me out with this? I hope its not too confusing.
Steve Schapel
Jan 15 2007, 11:37 PM
QuickSilver,
Try it like this...
[Forms]![frmMain]![MainSub]![cboProduct]
Or, as some would prefer it...
[Forms]![frmMain]![MainSub].[Form]![cboProduct]
Quicksilver2002
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"
Steve Schapel
Jan 16 2007, 12:22 AM
Quicksilver,
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?
Steve Schapel
Jan 16 2007, 12:25 AM
Quicksilver,
Are you absolutely certain that the name of the combobox is cboProduct?
Quicksilver2002
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!
Steve Schapel
Jan 16 2007, 01:44 PM
Quicksilver,
Thanks for letting us know. I am happy to see it's working for you now.
Quicksilver2002
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"
Else
MsgBox "Username or Password Incorrect."
End If
Quicksilver2002
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 helped me.
Steve Schapel
Jan 23 2007, 05:24 PM
Excellent!
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please
click here.