UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> Enter Parameter Issue with subforms    
 
   
Quicksilver2002
post Jan 15 2007, 11:30 PM
Post #1

UtterAccess Veteran
Posts: 306



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.
Go to the top of the page
 
+
Steve Schapel
post Jan 15 2007, 11:37 PM
Post #2

UtterAccess VIP
Posts: 3,881
From: New Zealand



QuickSilver,

Try it like this...
[Forms]![frmMain]![MainSub]![cboProduct]

Or, as some would prefer it...
[Forms]![frmMain]![MainSub].[Form]![cboProduct]
Go to the top of the page
 
+
Quicksilver2002
post Jan 15 2007, 11:42 PM
Post #3

UtterAccess Veteran
Posts: 306



Steve Thanks for the reply. I tried both and still get the Enter Parameter. Their is still another form "frmAuditInfo"
Go to the top of the page
 
+
Steve Schapel
post Jan 16 2007, 12:22 AM
Post #4

UtterAccess VIP
Posts: 3,881
From: New Zealand



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?
Go to the top of the page
 
+
Steve Schapel
post Jan 16 2007, 12:25 AM
Post #5

UtterAccess VIP
Posts: 3,881
From: New Zealand



Quicksilver,

Are you absolutely certain that the name of the combobox is cboProduct?
Go to the top of the page
 
+
Quicksilver2002
post Jan 16 2007, 01:16 PM
Post #6

UtterAccess Veteran
Posts: 306



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!
Go to the top of the page
 
+
Steve Schapel
post Jan 16 2007, 01:44 PM
Post #7

UtterAccess VIP
Posts: 3,881
From: New Zealand



Quicksilver,

Thanks for letting us know. I am happy to see it's working for you now.
Go to the top of the page
 
+
Quicksilver2002
post Jan 23 2007, 01:58 PM
Post #8

UtterAccess Veteran
Posts: 306



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
Go to the top of the page
 
+
Quicksilver2002
post Jan 23 2007, 02:32 PM
Post #9

UtterAccess Veteran
Posts: 306



Got it figured out with this
Forms!Main!SubMain.SourceObject = "frmAuditInfo"

If anyone else is having problems with this this web page helped me.
Go to the top of the page
 
+
Steve Schapel
post Jan 23 2007, 05:24 PM
Post #10

UtterAccess VIP
Posts: 3,881
From: New Zealand



Excellent! (IMG:http://www.utteraccess.com/forum/style_emoticons/default/sad.gif)
Go to the top of the page
 
+

Thank you for your support! Reply to this topicStart new topic

Jump To Forum:
 



RSS Go to Top  ·  Lo-Fi Version Time is now: 20th May 2013 - 10:23 AM