T
Thomas
Hello
I have a form that I have based on the NorthView Traders Orders (Form). I
needed to add a ComboBox to the Orders_Subform that list Categories and then
list only the Products with in that Category to ProductID ComboBox. I have
it working the only problem is that the ProductName (the text) disappears
when you close and reopen the Form. Is there any code for the Form on
Activate or ProductID ComboBox event that will refresh the ProductName (the
text).The Products ID# is save but you can't see it because I have the
ProductID ComboBox column widths set at 0"; 2".
Being a Access newbe is my thinking all wrong for the method to limit the
products.
As I am dealing with over 1000 Products
Any suggestions appreciated.
Thanks in advance
Categories ComboBox :
Private Sub Categories_AfterUpdate()
Me.ProductID.RowSource = "SELECT ProductID,ProductName FROM" & _
" Products WHERE CategoryID = " & Me.Categories & _
" ORDER BY ProductName"
Me.ProductID = Me.ProductID.ItemData(1)
End Sub
ProductsID ComboBox :
Private Sub ProductID_AfterUpdate()
On Error GoTo Err_ProductID_AfterUpdate
Dim strFilter As String
strFilter = "ProductID = " & Me!ProductID
Me!UnitPrice = DLookup("UnitPrice", "Products", strFilter)
Exit_ProductID_AfterUpdate:
Exit Sub
Err_ProductID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ProductID_AfterUpdate
End Sub
Private Sub ProductID_BeforeUpdate(Cancel As Integer)
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
If IsLoaded("Orders Subform") Then
strMsg = "You can't add or edit a Product Name when you open Orders
Subform as a standalone form."
intStyle = vbOKOnly
strTitle = "Can't Add or Change Product Name"
MsgBox strMsg, intStyle, strTitle
Me!ProductID.Undo
Me.Undo
End If
End Sub
The System at the store:
WinXP
Access 2003
I have a form that I have based on the NorthView Traders Orders (Form). I
needed to add a ComboBox to the Orders_Subform that list Categories and then
list only the Products with in that Category to ProductID ComboBox. I have
it working the only problem is that the ProductName (the text) disappears
when you close and reopen the Form. Is there any code for the Form on
Activate or ProductID ComboBox event that will refresh the ProductName (the
text).The Products ID# is save but you can't see it because I have the
ProductID ComboBox column widths set at 0"; 2".
Being a Access newbe is my thinking all wrong for the method to limit the
products.
As I am dealing with over 1000 Products
Any suggestions appreciated.
Thanks in advance
Categories ComboBox :
Private Sub Categories_AfterUpdate()
Me.ProductID.RowSource = "SELECT ProductID,ProductName FROM" & _
" Products WHERE CategoryID = " & Me.Categories & _
" ORDER BY ProductName"
Me.ProductID = Me.ProductID.ItemData(1)
End Sub
ProductsID ComboBox :
Private Sub ProductID_AfterUpdate()
On Error GoTo Err_ProductID_AfterUpdate
Dim strFilter As String
strFilter = "ProductID = " & Me!ProductID
Me!UnitPrice = DLookup("UnitPrice", "Products", strFilter)
Exit_ProductID_AfterUpdate:
Exit Sub
Err_ProductID_AfterUpdate:
MsgBox Err.Description
Resume Exit_ProductID_AfterUpdate
End Sub
Private Sub ProductID_BeforeUpdate(Cancel As Integer)
Dim strMsg As String, strTitle As String
Dim intStyle As Integer
If IsLoaded("Orders Subform") Then
strMsg = "You can't add or edit a Product Name when you open Orders
Subform as a standalone form."
intStyle = vbOKOnly
strTitle = "Can't Add or Change Product Name"
MsgBox strMsg, intStyle, strTitle
Me!ProductID.Undo
Me.Undo
End If
End Sub
The System at the store:
WinXP
Access 2003