Results 1 to 5 of 5
  1. #1
    Join Date
    Apr 2006
    Posts
    6

    Unanswered: Can someone help ?

    Hello everybody,

    I'm a newbie in ms access dev...
    By looking in this forum I've already managed to have a combobox with a query as "row source" depending on the value of a 2nd combobox... At first it was working just the first time the form was loaded and I found in this forum that I had to requery using the "after update" of this 2nd combobox by writing few VBA code like Me.FirstCombobox.Requery. This works perfect. But now I'd like to have the first row of that query to be displayed as default value for that 2nd Combobox. Is there a simple way to do that?
    Thanks in advance for your help
    Thierry

  2. #2
    Join Date
    Sep 2003
    Location
    MI
    Posts
    3,713
    Yes. Direct assignment. Ex:

    2ndCombobox.Value=PrimaryCombobox.Value

    And you'd put this into the same afterUpdate event ...

    This assumes that the bound columns for each combobox has the same type of data ...
    Back to Access ... ADO is not the way to go for speed ...

  3. #3
    Join Date
    Apr 2006
    Posts
    6
    Thanks for the reply, but it's not what I want. I probably didn't express me correctly. Let's say simply maybe that I'd like something like that:
    2ndCombobox.Value=MyQuery.firstRow
    MyQuery is the rowSource for that 2ndCombobox and is build using the value of a PrimaryCombobox.
    I hope it's more clear like this and thanks again
    Thierry

  4. #4
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    so you want to have the combo box automatically display the first value of the query by default?

    Add 2ndCombobox.Value = 2ndCombobox.ItemData(0) after the requery statement. This sets the box to the first item in the list (the list index, like many indexes in Access, starts at 0)

  5. #5
    Join Date
    Apr 2006
    Posts
    6
    This is exactly the info what I was missing !!!
    Thanks a lot tcace :-)

Posting Permissions

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