Combo Box Recordsource When using CodeDB

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AP

    #1

    Combo Box Recordsource When using CodeDB

    I am working on an add-on and i have a form with a combo box. if the
    user picks one option, the combo box is populated with a query that is
    based on a table in the CodeDB, if the user selects another option, the
    combo box is populated with a query based on a table in the CurrentDB.
    I do not know how to reference the CurrentDb from the CodeDB

    I use a SQL string to set the row source of the combo box, something
    like,
    "Select * from Cities" if it is in the CodeDB and I would like it to do
    something like

    "Select * from States" from the Current DB, but I do not know how to
    reference the currentDB in the SQL string? My only thought is to
    manually create a string of the records and set it that way, because I
    dont have a problem setting the recordset, I just dont know how to get
    it to the combo box.

    Any ideas?
    Thanks

  • Ed Robichaud

    #2
    Re: Combo Box Recordsource When using CodeDB

    Have both tables (regardless of the resident database) linked to your open
    database, then set the recordsource of your combobox to:
    = IIF(UserChoice= 1, "Select * from Cities", "Select * from States")
    -Ed


    "AP" <aphoenix@thomp songroup.com> wrote in message
    news:1135029604 .518304.165730@ z14g2000cwz.goo glegroups.com.. .[color=blue]
    >I am working on an add-on and i have a form with a combo box. if the
    > user picks one option, the combo box is populated with a query that is
    > based on a table in the CodeDB, if the user selects another option, the
    > combo box is populated with a query based on a table in the CurrentDB.
    > I do not know how to reference the CurrentDb from the CodeDB
    >
    > I use a SQL string to set the row source of the combo box, something
    > like,
    > "Select * from Cities" if it is in the CodeDB and I would like it to do
    > something like
    >
    > "Select * from States" from the Current DB, but I do not know how to
    > reference the currentDB in the SQL string? My only thought is to
    > manually create a string of the records and set it that way, because I
    > dont have a problem setting the recordset, I just dont know how to get
    > it to the combo box.
    >
    > Any ideas?
    > Thanks
    >[/color]


    Comment

    Working...