Results 1 to 4 of 4
  1. #1
    Join Date
    Jun 2003
    Posts
    2

    Unanswered: Cascading ComboBox form

    I have used the examples from previous messages about creating a cascading combobox and they have work really well for me. Now I would like to take it one step further.

    I have my first cbobox which allows me to pare down to the list I will select for my second cbobox. Based on my two selections I do a query to populate some view only text boxes giving descriptions of the product, etc.

    What I want to do is when I make a new selection from my first cbobox, it will clear all the fields on my form. I've tried using setvalue, but it does exactly what it says it will do. It changes the values of my record.

    Any suggests on how I should accomplish this?

    Thanks
    David

  2. #2
    Join Date
    Nov 2002
    Location
    Hamilton,Ontario
    Posts
    132

    Re: Cascading ComboBox form

    1-I placed one Command Button on form.
    2-In onClick event I called ClearAll Sub.
    Private Sub command4_Click()
    Call clearAll(Me)
    End Sub

    3-Passing the FormName by ref

    Public Sub clearAll(ByRef Form As Form)
    Dim ctrl As Control
    For Each ctrl In Form
    If TypeOf ctrl Is TextBox Or TypeOf ctrl Is ComboBox Or TypeOf ctrl Is CheckBox Then
    ctrl.Value = Null
    End If
    Next ctrl
    Form.Refresh
    End Sub


    Hope this helps

  3. #3
    Join Date
    Jun 2003
    Location
    USA
    Posts
    1,032
    Or try this:

    TempVar = ctrMyFirstCombo

    DoCmd.RunCommand acCmdUndo

    ctrMyFirstCombo = TempVar
    J. Paul Schmidt, Freelance Web and Database Developer
    www.Bullschmidt.com
    Access Database Sample, Web Database Sample, ASP Design Tips

  4. #4
    Join Date
    Jun 2003
    Posts
    2

    Smile

    Thanks!

    I'll give them both a try.

    David

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •