Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 2004
    Posts
    3

    Unanswered: Dlookup across multiple tables

    I need to be able to use DLookup to look for data in two separate tables.

    Code for DLookup utilizing just one table (this works):

    30day: DLookUp([tbl_Ticker_Sheet01].[ticker],"[tbl_030day_Sheet01-a]","numb=" & [Forms]![frm_HistData1]![txt_MaxNumb])

    What I thought would work for two tables:
    30day: IIF(IsNull(DLookUp([tbl_Ticker_Sheet01].[ticker],"[tbl_030day_Sheet01-a]","numb=" & [Forms]![frm_HistData1]![txt_MaxNumb])), DLookUp([tbl_Ticker_Sheet01].[ticker],"[tbl_030day_Sheet01-b]","numb=" & [Forms]![frm_HistData1]![txt_MaxNumb]), DLookUp([tbl_Ticker_Sheet01].[ticker],"[tbl_030day_Sheet01-a]","numb=" & [Forms]![frm_HistData1]![txt_MaxNumb]))

    **the data in [tbl_030day_Sheet01-a] table is returned but a #Error is returned for all data in the [tbl_030day_Sheet01-b] table


    I cant even get the following to work

    30day: IIf(IsNull(DLookUp([tbl_Ticker_Sheet01].[ticker],"[tbl_030day_Sheet01-a]","numb=" & [Forms]![frm_HistData1]![txt_MaxNumb])),True,False)

    **A 0 is returned if the data in the [tbl_030day_Sheet01-a] table, however #Error appears if its not in that table

  2. #2
    Join Date
    Feb 2004
    Posts
    142
    Perhaps you should open recordsets with SQL statements instead. Dlookup is not an efficient way to move much data.
    KC

  3. #3
    Join Date
    Apr 2004
    Posts
    3

    Question

    Originally posted by AZ KC
    Perhaps you should open recordsets with SQL statements instead. Dlookup is not an efficient way to move much data.
    ---Can you give me some pointers on where to get started in SQL?

Posting Permissions

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