Re: Cascading ComboBox text disappears
From: GVaught (glvaughtRemoveThis_at_hotmail.com)
Date: 05/16/04
- Next message: GVaught: "Re: Clicking on a button on form from VBA"
- Previous message: tina: "Re: Lock a text field after an update"
- In reply to: Thomas: "Cascading ComboBox text disappears"
- Next in thread: Thomas: "Re: Cascading ComboBox text disappears"
- Reply: Thomas: "Re: Cascading ComboBox text disappears"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 15 May 2004 18:43:38 -0600
If I understand you correctly your combo box will come back empty after you
close and reopen the form as you have not picked a category. What you may
have to do is load all the category choices to the Category combo box using
the OnLoad Event of the form. Then upon a selection fill the product combo
box. The form won't remember your last selection unless you make provisions
to saving that information, which would not be a good idea.
"Thomas" <wills.t@sbcglobal.net> wrote in message
news:%Vvpc.67537$Qd.11903@newssvr25.news.prodigy.com...
> 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
>
>
- Next message: GVaught: "Re: Clicking on a button on form from VBA"
- Previous message: tina: "Re: Lock a text field after an update"
- In reply to: Thomas: "Cascading ComboBox text disappears"
- Next in thread: Thomas: "Re: Cascading ComboBox text disappears"
- Reply: Thomas: "Re: Cascading ComboBox text disappears"
- Messages sorted by: [ date ] [ thread ]