Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2007
    Posts
    17

    Unanswered: change combobox values

    hello
    i have two comboboxes, i want to change the values of one combobox when the user selects a value in the other one but i'm not sure how to do that, i'm trying with subforms without good results, here's what i'm doing

    let's say i have three tables: categories, products and models, the records they store behave like a three, i mean, each model is related to a product and each product related to a category, this may be resumed like this:

    table:categories
    fields: id, name, dependencie

    table: products
    fields: id,name,category

    table:models
    fields: id,name,product

    i want to show the categories in a combobox and when i select a value in that combo populate the 2nd combo with the corresponding products, and do the exact same thing after select a value in the products combo: populate the models combo with the models that correspond to the product selected.

    after that the user would choose a value from the models combo and a subform would show the specific info for that product/model

    i'm trying to do this with nested subforms but i haven't found how to relate one to another, and i'm not sure this is the best way

    could you tell me what is the best way to accomplish this??

    thanks for your help

  2. #2
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    The simplest way is what's called "cascading" combos. Search here on that and you should find examples.
    Paul

  3. #3
    Join Date
    Feb 2007
    Posts
    17
    hello
    first of all thanks for your help, you solved my problem, now i just need to know how to show the column with the names instead of the one with the keys, i used a query like "select table.key, table.name from ..." and only the 'key' column is displayed, i have read the help and it says there is a TextColumn property that will set the column that contains the text to be shown, however when i run the code i got a 'member not found' error in the TextColumn line, this happens with both listbox and combobox

    here is the relevant code:

    Code:
    Private Sub categoriasCombo_Change()
     Dim sqlstr As String
        sqlstr = "select articulos.clave,articulos.nombre from articulos where articulos.categoria=categoriasCombo.value"
        articulosCombo.RowSource = sqlstr
        articulosCombo.BoundColumn = 1
        articulosCombo.TextColumn = 2 'error here
    End Sub
    currently the listbox/combobox only shows the 'clave' column, how can i set it to show the 'nombre' column??
    thanks for your help
    Last edited by ramone; 02-13-07 at 02:36.

  4. #4
    Join Date
    May 2005
    Location
    Nevada, USA
    Posts
    2,888
    Provided Answers: 6
    You want to set the column widths to 0;2, or whatever width you want for the displayed column.
    Paul

Posting Permissions

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