selection from combobox updates to table

G

Guest

I am using the following to filter a combo box (cbocategoryID) filters an
unbound cbo behind txtbox ProductName.

Productname and the unbound are getting their info from ProductsTTL Tbl.

(This is part of the purchaseordersubform based on a query. That combines
ProductsTTL and Order Details) My problem is when I select the item I want it
is not writing the ProductID to the Order Details.ProductID field. And I
don't know how to do it.

Private Sub cboCategoryID_AfterUpdate()
Dim ProductName As String

ProductName = "SELECT [ProductsTTL].[ProductID],
[ProductsTTL].[CategoryID], [ProductsTTL].[ProductName] " & _
"FROM ProductsTTL " & _
"WHERE [CategoryID] = " & Me.cboCategoryID.Value
'"ORDER BY ProductsTTL.ProductName;"

Me.cboProductName.RowSource = ProductName
Me.cboProductName.Requery

End Sub

I have looked at numerous examples and still cannot figure out how to do this.
thanks! in advance
 
G

Guest

That's the answer!! Thanks!

Tom Wickerath said:
It sounds to me like you need to give cboProductName a control source (Order
Details.ProductID), so that it becomes a bound control.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________


lmv said:
I am using the following to filter a combo box (cbocategoryID) filters an
unbound cbo behind txtbox ProductName.

Productname and the unbound are getting their info from ProductsTTL Tbl.

(This is part of the purchaseordersubform based on a query. That combines
ProductsTTL and Order Details) My problem is when I select the item I want it
is not writing the ProductID to the Order Details.ProductID field. And I
don't know how to do it.

Private Sub cboCategoryID_AfterUpdate()
Dim ProductName As String

ProductName = "SELECT [ProductsTTL].[ProductID],
[ProductsTTL].[CategoryID], [ProductsTTL].[ProductName] " & _
"FROM ProductsTTL " & _
"WHERE [CategoryID] = " & Me.cboCategoryID.Value
'"ORDER BY ProductsTTL.ProductName;"

Me.cboProductName.RowSource = ProductName
Me.cboProductName.Requery

End Sub

I have looked at numerous examples and still cannot figure out how to do this.
thanks! in advance
 
G

Guest

Glad to hear that you got it working. Thank You for replying back.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________

lmv said:
That's the answer!! Thanks!

Tom Wickerath said:
It sounds to me like you need to give cboProductName a control source (Order
Details.ProductID), so that it becomes a bound control.


Tom

http://www.access.qbuilt.com/html/expert_contributors.html
http://www.access.qbuilt.com/html/search.html
__________________________________________


lmv said:
I am using the following to filter a combo box (cbocategoryID) filters an
unbound cbo behind txtbox ProductName.

Productname and the unbound are getting their info from ProductsTTL Tbl.

(This is part of the purchaseordersubform based on a query. That combines
ProductsTTL and Order Details) My problem is when I select the item I want it
is not writing the ProductID to the Order Details.ProductID field. And I
don't know how to do it.

Private Sub cboCategoryID_AfterUpdate()
Dim ProductName As String

ProductName = "SELECT [ProductsTTL].[ProductID],
[ProductsTTL].[CategoryID], [ProductsTTL].[ProductName] " & _
"FROM ProductsTTL " & _
"WHERE [CategoryID] = " & Me.cboCategoryID.Value
'"ORDER BY ProductsTTL.ProductName;"

Me.cboProductName.RowSource = ProductName
Me.cboProductName.Requery

End Sub

I have looked at numerous examples and still cannot figure out how to do this.
thanks! in advance
 

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