A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Cascading Combo Subform Tied to Parent



 
 
Thread Tools Display Modes
  #1  
Old August 18th, 2006, 07:07 PM posted to microsoft.public.access.forms
Tim
external usenet poster
 
Posts: 780
Default Cascading Combo Subform Tied to Parent

I'm trying to get a cascading combo box in my subform to tie to a combo box
in my parent form. What am I missing???

Private Sub cboSupply()
On Error Resume Next
cboSupply.RowSource = "Select DISTINCT tblSupply.SUPPLYNAME " & _
"FROM tblSupply " & _
"WHERE tblSupply.SUPPLIERNAME = '" & Parent.[cboSupplier] & "' " & _
"ORDER BY tblSupply.SUPPLYNAME;"
End Sub

Thank you.
  #2  
Old August 18th, 2006, 07:15 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Cascading Combo Subform Tied to Parent

What happens when you run that code?

Does Parent.[cboSupplier] return what you think it does? (In other words,
you seem to be expecting a name: is that what it returns?)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Tim" wrote in message
news
I'm trying to get a cascading combo box in my subform to tie to a combo
box
in my parent form. What am I missing???

Private Sub cboSupply()
On Error Resume Next
cboSupply.RowSource = "Select DISTINCT tblSupply.SUPPLYNAME " & _
"FROM tblSupply " & _
"WHERE tblSupply.SUPPLIERNAME = '" & Parent.[cboSupplier] & "' " &
_
"ORDER BY tblSupply.SUPPLYNAME;"
End Sub

Thank you.



  #3  
Old August 18th, 2006, 07:26 PM posted to microsoft.public.access.forms
Tim
external usenet poster
 
Posts: 780
Default Cascading Combo Subform Tied to Parent

I'm setting up a purchase order w/ the Supply Name, $, and quantity ordered
in the subform and the Supplier Name in the Parent form. I only want to see
an individual Suppliers supplies.

What happens when I run this, is the supply combo box doesn't limit the
supplies to the particular supplier.


"Douglas J. Steele" wrote:

What happens when you run that code?

Does Parent.[cboSupplier] return what you think it does? (In other words,
you seem to be expecting a name: is that what it returns?)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Tim" wrote in message
news
I'm trying to get a cascading combo box in my subform to tie to a combo
box
in my parent form. What am I missing???

Private Sub cboSupply()
On Error Resume Next
cboSupply.RowSource = "Select DISTINCT tblSupply.SUPPLYNAME " & _
"FROM tblSupply " & _
"WHERE tblSupply.SUPPLIERNAME = '" & Parent.[cboSupplier] & "' " &
_
"ORDER BY tblSupply.SUPPLYNAME;"
End Sub

Thank you.




  #4  
Old August 18th, 2006, 07:29 PM posted to microsoft.public.access.forms
Tim
external usenet poster
 
Posts: 780
Default Cascading Combo Subform Tied to Parent

I don't get the Supply combo box in the subform to limit the supply to the
Supplier.

I am trying to build a form for Purchase orders where the Supplier appears
in the parent form and the Supply, $, and Quantity ordered appear in the
subform. I want the supply combo box to be limited to the supplies the
supplier in the parent form supplys.

Thank you.

"Douglas J. Steele" wrote:

What happens when you run that code?

Does Parent.[cboSupplier] return what you think it does? (In other words,
you seem to be expecting a name: is that what it returns?)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Tim" wrote in message
news
I'm trying to get a cascading combo box in my subform to tie to a combo
box
in my parent form. What am I missing???

Private Sub cboSupply()
On Error Resume Next
cboSupply.RowSource = "Select DISTINCT tblSupply.SUPPLYNAME " & _
"FROM tblSupply " & _
"WHERE tblSupply.SUPPLIERNAME = '" & Parent.[cboSupplier] & "' " &
_
"ORDER BY tblSupply.SUPPLYNAME;"
End Sub

Thank you.




  #5  
Old August 19th, 2006, 02:14 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Cascading Combo Subform Tied to Parent

And the answer to my question about what Parent.[cboSupplier] returns
is....?

Try the following:

Private Sub cboSupply()
On Error Resume Next

Dim strSQL As String

strSQL = "Select DISTINCT tblSupply.SUPPLYNAME " & _
"FROM tblSupply " & _
"WHERE tblSupply.SUPPLIERNAME = '" & Parent.[cboSupplier] & "' " & _
"ORDER BY tblSupply.SUPPLYNAME;"

Debug.Print strSQL

cboSupply.RowSource = strSQL

End Sub

Go to the Immediate Window (Ctrl-G) and look at what's printed for strSQL.
Paste it back here.

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no private e-mails, please)


"Tim" wrote in message
...
I don't get the Supply combo box in the subform to limit the supply to the
Supplier.

I am trying to build a form for Purchase orders where the Supplier appears
in the parent form and the Supply, $, and Quantity ordered appear in the
subform. I want the supply combo box to be limited to the supplies the
supplier in the parent form supplys.

Thank you.

"Douglas J. Steele" wrote:

What happens when you run that code?

Does Parent.[cboSupplier] return what you think it does? (In other words,
you seem to be expecting a name: is that what it returns?)

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Tim" wrote in message
news
I'm trying to get a cascading combo box in my subform to tie to a combo
box
in my parent form. What am I missing???

Private Sub cboSupply()
On Error Resume Next
cboSupply.RowSource = "Select DISTINCT tblSupply.SUPPLYNAME " & _
"FROM tblSupply " & _
"WHERE tblSupply.SUPPLIERNAME = '" & Parent.[cboSupplier] & "' "
&
_
"ORDER BY tblSupply.SUPPLYNAME;"
End Sub

Thank you.






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.