Results 1 to 10 of 10

Thread: Drop down list help please!

  1. #1
    Join Date
    Jun 2006
    Posts
    30

    Drop down list help please!

    hi everyone,

    i'm new to this forum.

    I have a drop-down list that I want to populate from one of the columns in a table. But i want to do this with VBA and embedded sql, instead of building the query and populate it via the query builder.

    The reason for this is that I'm saving the project as an MDE file, and my database is residing in another *.mdb file. Thus the MDE file is just the executable version.

    I can't seem to "read" the table without using VBA to do it.

    Can anyone help me please?

    thanks.

  2. #2
    Join Date
    May 2006
    Posts
    407
    Quote Originally Posted by rexwrx
    I have a drop-down list that I want to populate from one of the columns in a table. But i want to do this with VBA and embedded sql, instead of building the query and populate it via the query builder.
    ...
    I can't seem to "read" the table without using VBA to do it.
    First you say you want to do this with VBA, then you say you can't "read" the table without using VBA.
    I'd like to help, but I really don't understand what you mean. Could you explain it a bit more?

  3. #3
    Join Date
    Jun 2006
    Posts
    30
    Quote Originally Posted by GolferGuy
    First you say you want to do this with VBA, then you say you can't "read" the table without using VBA.
    I'd like to help, but I really don't understand what you mean. Could you explain it a bit more?
    hee sorry.

    what i meant is this:

    I want to grab the value of the drop-down list from a table residing in another database. Because of this reason, I cannot use the Properties->RowSource->select.....from... method on the form.

    I would therefore like to use VBA to code it and grab the values of the drop down list from the table which is on another database.

    thanks.

  4. #4
    Join Date
    May 2006
    Posts
    407
    This article will discribe how to write a function to fill the combo box. I've done before, it works great, but if you have any questions while working on this, ask! This is not the most straight forword thing to do.
    http://msdn.microsoft.com/library/de...ce04062000.asp

  5. #5
    Join Date
    Jun 2006
    Posts
    30

    Arrow

    Quote Originally Posted by GolferGuy
    This article will discribe how to write a function to fill the combo box. I've done before, it works great, but if you have any questions while working on this, ask! This is not the most straight forword thing to do.
    http://msdn.microsoft.com/library/de...ce04062000.asp
    hi again,

    is there a simpler way of doing this?? can anyone help out here please?

    i still want to grab the value of the list via VBA rather than the usual RowSource Properties type.

    thanks!!

  6. #6
    Join Date
    May 2006
    Posts
    407
    Sorry, but this is the way Microsoft has set up to fill the combo box. Other ways would be to use VBA to write the data you want in the combo box into a table. Of course, you would have already set this table to be the row source for your combo box.

    And, if we are lucky, maybe someone out there has written a class that might make this process easier.

    Good luck,
    Vic

  7. #7
    Join Date
    Dec 2005
    Posts
    18
    1) To fill list with table from another database, you can link that table (even using VBA - see TableDef F1) and then use it as appropriate RowSource of combobox

    2) To populate ComboBox using custom value list, you can set it's rowsource type to "Value List" and use code
    Code:
    YourComboBox.AddItem "your item"

  8. #8
    Join Date
    Jun 2006
    Posts
    30
    thanks again.

    can you please be more specific in your example? i don't quite understand.

    thanks.

  9. #9
    Join Date
    Dec 2005
    Posts
    18
    Assume you have Form1 with ComboBox1 (RowSource Type set to "VAlue list")
    Try Making event AfterUpdate of ComboBox1. Enter code
    Code:
    Me.ComboBox1.AddItem Me.ComboBox1, 0
    And see what comes when you update ComboBox values

  10. #10
    Join Date
    Jun 2006
    Posts
    30
    cool. i'll go try it n update again.

Posting Permissions

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