Cascading combo problem

  • Thread starter Aries via AccessMonster.com
  • Start date
A

Aries via AccessMonster.com

Help in cascading combo box coding. I have this code but when I click
"cboProduct" it asks me for parameter value. what could be wrong with this?
cboManufacturer and cboCategory are unbound and cboProduct is bound. the form
is bound to tblStockInventory for inventrory transaction entries.

Private Sub cboCategory_AfterUpdate()

With Me![cboProduct]
If IsNull(Me!cboCategory) Then
.RowSource = ""
Else
.RowSource = "SELECT [ProductName] " & _
"FROM Products " & _
"WHERE [CategoryID]=" & Me!cboCategory
End If
Call .Requery
End With

End Sub

Private Sub cboManufacturer_AfterUpdate()

With Me![cboCategory]
If IsNull(Me!cboManufacturer) Then
.RowSource = ""
Else
.RowSource = "SELECT [CategoryName] " & _
"FROM Manufacturer_Category INNER JOIN ProductCategory ON
Manufacturer_Category.CategoryID = ProductCategory.CategoryID " & _
"WHERE [ManufacturerID]=" & Me!cboManufacturer
End If
Call .Requery
End With

End Sub


I currently have these tables

Manufacturer
ManufacturerID - Pk
ManufacturerName

Category
CategoryID - Pk
CategoryName

Products
ProductID - Pk
ProductName
CategoryID
ManufacturerID

StockInventory
InventoryID - Pk
ProductID
CategoryID
TransactionDate
Qty
Amount

Manufacturer_Category
ID -Pk
ManufacturerID
CategoryID

Hope you can help me. Thanks!
 
J

Jeff Boyce

What parameter does it prompt for?

Regards

Jeff Boyce
Microsoft Office/Access MVP
 
A

Aries via AccessMonster.com

Hi Jeff, it asks a parameter value for the "category" I selected in the
cbocategory combo box. the cboManufacturer and cboCategory works fine until
I reach the third combo box which is for the product "cboProduct" it keeps on
asking me for a value and I can't understand why or where its coming from.

Jeff said:
What parameter does it prompt for?

Regards

Jeff Boyce
Microsoft Office/Access MVP
Help in cascading combo box coding. I have this code but when I click
"cboProduct" it asks me for parameter value. what could be wrong with
[quoted text clipped - 65 lines]
Hope you can help me. Thanks!
 
J

Jeff Boyce

A query (e.g., underlying a combobox) usually prompts for a parameter when
it can't find something spelled EXACTLY like what's inside the square
brackets ('[]'). Check your spelling first...

Regards

Jeff Boyce
Microsoft Office/Access MVP

Aries via AccessMonster.com said:
Hi Jeff, it asks a parameter value for the "category" I selected in the
cbocategory combo box. the cboManufacturer and cboCategory works fine
until
I reach the third combo box which is for the product "cboProduct" it keeps
on
asking me for a value and I can't understand why or where its coming from.

Jeff said:
What parameter does it prompt for?

Regards

Jeff Boyce
Microsoft Office/Access MVP
Help in cascading combo box coding. I have this code but when I click
"cboProduct" it asks me for parameter value. what could be wrong with
[quoted text clipped - 65 lines]
Hope you can help me. Thanks!
 
A

Aries via AccessMonster.com

Ok, I've checked the spelling many times and I can't seem to find anything
inconsistent about it. I believe its the way I made the code that's giving me
this problem.

I uploaded my db here.. http://www.savefile.com/files/2063018

hope you can find time to have a look and help me figure out what's wrong.


Thanks again!

Aries.


Jeff said:
A query (e.g., underlying a combobox) usually prompts for a parameter when
it can't find something spelled EXACTLY like what's inside the square
brackets ('[]'). Check your spelling first...

Regards

Jeff Boyce
Microsoft Office/Access MVP
Hi Jeff, it asks a parameter value for the "category" I selected in the
cbocategory combo box. the cboManufacturer and cboCategory works fine
[quoted text clipped - 15 lines]
 
A

Aries via AccessMonster.com

Ok, I think I got it, here's the new code

Private Sub cboCategory_AfterUpdate()

With Me![cboProduct]
If IsNull(Me!cboCategory) Then
.RowSource = ""
Else
.RowSource = "SELECT Products.ProductID, Products.ProductName,
Products.ManufacturerID, Products.CategoryID " & _
"FROM Products " & _
"WHERE [CategoryID]=" & Me!cboCategory
End If

Call .Requery

End With

End Sub

Private Sub cboManufacturer_AfterUpdate()

With Me![cboCategory]
If IsNull(Me!cboManufacturer) Then
.RowSource = ""
Else
.RowSource = "SELECT ProductCategory.CategoryID, ProductCategory.
CategoryName " & _
"FROM Manufacturer_Category INNER JOIN ProductCategory ON
Manufacturer_Category.CategoryID = ProductCategory.CategoryID " & _
"WHERE [ManufacturerID]=" & Me!cboManufacturer
End If

Call .Requery

End With

End Sub


now, I just need to know the right way to also include the ManufacturerID
together with the categoryID in filtering the product selection. I believe I
need to use "AND" in the "WHERE" clause? but dont know how to. a little more
help here would be nice.

thanks!

Help in cascading combo box coding. I have this code but when I click
"cboProduct" it asks me for parameter value. what could be wrong with this?
cboManufacturer and cboCategory are unbound and cboProduct is bound. the form
is bound to tblStockInventory for inventrory transaction entries.

Private Sub cboCategory_AfterUpdate()

With Me![cboProduct]
If IsNull(Me!cboCategory) Then
.RowSource = ""
Else
.RowSource = "SELECT [ProductName] " & _
"FROM Products " & _
"WHERE [CategoryID]=" & Me!cboCategory
End If
Call .Requery
End With

End Sub

Private Sub cboManufacturer_AfterUpdate()

With Me![cboCategory]
If IsNull(Me!cboManufacturer) Then
.RowSource = ""
Else
.RowSource = "SELECT [CategoryName] " & _
"FROM Manufacturer_Category INNER JOIN ProductCategory ON
Manufacturer_Category.CategoryID = ProductCategory.CategoryID " & _
"WHERE [ManufacturerID]=" & Me!cboManufacturer
End If
Call .Requery
End With

End Sub

I currently have these tables

Manufacturer
ManufacturerID - Pk
ManufacturerName

Category
CategoryID - Pk
CategoryName

Products
ProductID - Pk
ProductName
CategoryID
ManufacturerID

StockInventory
InventoryID - Pk
ProductID
CategoryID
TransactionDate
Qty
Amount

Manufacturer_Category
ID -Pk
ManufacturerID
CategoryID

Hope you can help me. Thanks!
 
A

Aries via AccessMonster.com

I Finally got it after reading some examples!

Thank you Access Monster.

Ok, I think I got it, here's the new code

Private Sub cboCategory_AfterUpdate()

With Me![cboProduct]
If IsNull(Me!cboCategory) Then
.RowSource = ""
Else
.RowSource = "SELECT Products.ProductID, Products.ProductName,
Products.ManufacturerID, Products.CategoryID " & _
"FROM Products " & _
"WHERE [CategoryID]=" & Me!cboCategory
End If

Call .Requery

End With

End Sub

Private Sub cboManufacturer_AfterUpdate()

With Me![cboCategory]
If IsNull(Me!cboManufacturer) Then
.RowSource = ""
Else
.RowSource = "SELECT ProductCategory.CategoryID, ProductCategory.
CategoryName " & _
"FROM Manufacturer_Category INNER JOIN ProductCategory ON
Manufacturer_Category.CategoryID = ProductCategory.CategoryID " & _
"WHERE [ManufacturerID]=" & Me!cboManufacturer
End If

Call .Requery

End With

End Sub

now, I just need to know the right way to also include the ManufacturerID
together with the categoryID in filtering the product selection. I believe I
need to use "AND" in the "WHERE" clause? but dont know how to. a little more
help here would be nice.

thanks!
Help in cascading combo box coding. I have this code but when I click
"cboProduct" it asks me for parameter value. what could be wrong with this?
[quoted text clipped - 62 lines]
Hope you can help me. Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top