Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

Dlookup question

Discussion in 'Information Technology' started by JOM, Nov 10, 2005.

  1. JOM

    JOM
    Expand Collapse
    Guest

    can you use dlookup to find more than 1 item from a table e.g.,
    dlookup("Field1","field2",[tblName],field 1=0)
     
  2. Loading...

    Similar Threads Forum Date
    Question About GGS Questions and Answers Aug 28, 2016
    Marriage And Discrimination Related Questions Blogs Mar 21, 2016
    Sikhi Questioning Faith Sikh Sikhi Sikhism Mar 3, 2016
    Entering into Sikhism: Questions on Reht Maryada. Blogs Oct 22, 2015
    A question about kes/hair? Blogs Oct 21, 2015

  3. Ofer

    Ofer
    Expand Collapse
    Guest

    No, you'll need to open a RecordSet

    --
    The next line is only relevant to Microsoft''s web-based interface users.
    If I answered your question, please mark it as an answer. It''s useful to
    know that my answer was helpful
    HTH, good luck


    "JOM" wrote:

    > can you use dlookup to find more than 1 item from a table e.g.,
    > dlookup("Field1","field2",[tblName],field 1=0)
    >
     
  4. Douglas J. Steele

    Douglas J. Steele
    Expand Collapse
    Guest

    Sort of.

    DLookup will only return a single value, but you can have it concatenate
    fields together. For example, you could have it return field1 and field2
    separated by a comma, and then split the values apart afterwards.

    Dim strField1 As String
    Dim strField2 As String
    Dim strReturn As String

    strReturn = DLookup("[Field1] & ',' & [Field2]", _
    "[tblName]", "[Field1] = 0")

    strField1 = Left(strReturn, InStr(strReturn, ",") - 1)
    strField2 = Mid(strReturn, InStr(strReturn, ",") + 1)

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)



    "JOM" <JOM@discussions.microsoft.com> wrote in message
    news:A2AA7392-01E0-4CB9-91F9-F93340F35504@microsoft.com...
    > can you use dlookup to find more than 1 item from a table e.g.,
    > dlookup("Field1","field2",[tblName],field 1=0)
    >
     
  5. Ofer

    Ofer
    Expand Collapse
    Guest

    Amaizing, I had no Idea.
    So you can actually return unlimited amount of fields

    Dim strField1 As String
    Dim strField2 As String
    Dim strField3 As String
    Dim strReturn As String

    strReturn = DLookup("[Field1] & ',' & [Field2] & ',' & [Field3]", _
    "[tblName]", "[Field1] = 0")

    strField1 = split(strReturn ,",")(0)
    strField2 = split(strReturn ,",")(1)
    strField3 = split(strReturn ,",")(2)

    Thank you, Douglas

    "Douglas J. Steele" wrote:

    > Sort of.
    >
    > DLookup will only return a single value, but you can have it concatenate
    > fields together. For example, you could have it return field1 and field2
    > separated by a comma, and then split the values apart afterwards.
    >
    > Dim strField1 As String
    > Dim strField2 As String
    > Dim strReturn As String
    >
    > strReturn = DLookup("[Field1] & ',' & [Field2]", _
    > "[tblName]", "[Field1] = 0")
    >
    > strField1 = Left(strReturn, InStr(strReturn, ",") - 1)
    > strField2 = Mid(strReturn, InStr(strReturn, ",") + 1)
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    >
    > "JOM" <JOM@discussions.microsoft.com> wrote in message
    > news:A2AA7392-01E0-4CB9-91F9-F93340F35504@microsoft.com...
    > > can you use dlookup to find more than 1 item from a table e.g.,
    > > dlookup("Field1","field2",[tblName],field 1=0)
    > >

    >
    >
    >
     

Share This Page