Welcome to SPN

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

Sign Up Now!

dlookup or not dlookup...

Discussion in 'Information Technology' started by lula, Nov 18, 2005.

Tags:
  1. lula

    lula
    Expand Collapse
    Guest

    hi.... I have a question... the other day "ofer" helped me with a dlookup
    syntax and I have one more question...

    I'm importing the fields of a word document into my database and I'm convert
    each part of the word doc into the id value of my tables in my database.

    ie: in the word doc I have urgency: average
    in my database I have a Urgency table where the "average" id is 1.

    and in code I'm grabbing that "average" and With the dlookup I look for the
    "average" id, so it brings me the #: 1.

    Now, here is the question... I have 2 fields in my database that are Yes/No
    fields. how do I do it with those 2 fields???

    I hope someone understand what I need and can help me.....

    thank you for your help in advance!
     
  2. Ofer

    Ofer
    Expand Collapse
    Guest

    I'm not sure if you want to return this two fields, or filter on them

    To return to fields combined, you can use the dlookup as follows

    =DlookUp("[Field1] & [Field2]","TableName","Field1='Value'")
    ===========================================
    To filter on a Yes/No field
    =DlookUp("[Field1]","TableName","Field1=True")
    Or , use false
    ===========================================
    To filter on two fields on the same time
    =DlookUp("[Field1]","TableName","Field1='Value' And Field2 = True")

    or with parameter
    =DlookUp("[Field1]","TableName","Field1='" & Value & "' And Field2 = True")

    Mybe one of the example answered your question, or if Im in the right
    direction then please tell me if you need any more help

    --
    I hope that helped
    Good Luck


    "lula" wrote:

    > hi.... I have a question... the other day "ofer" helped me with a dlookup
    > syntax and I have one more question...
    >
    > I'm importing the fields of a word document into my database and I'm convert
    > each part of the word doc into the id value of my tables in my database.
    >
    > ie: in the word doc I have urgency: average
    > in my database I have a Urgency table where the "average" id is 1.
    >
    > and in code I'm grabbing that "average" and With the dlookup I look for the
    > "average" id, so it brings me the #: 1.
    >
    > Now, here is the question... I have 2 fields in my database that are Yes/No
    > fields. how do I do it with those 2 fields???
    >
    > I hope someone understand what I need and can help me.....
    >
    > thank you for your help in advance!
    >
    >
    >
    >
     
  3. lula

    lula
    Expand Collapse
    Guest

    thank you ofer for your help, but actually I don't know what I need.. jaja.

    let me explain myself again, cos I don't think it's any of the options you
    gave me.

    I have a word doc for computer repair requests with formfields where the
    people choose an option from. (ie: urgency could be: low, average or high)
    In my database, I have tables that codifies those options (Urgency table has
    id_urgency and desc_urgency)

    so far I'm trying to grab those formfields like this:

    Dim strUrgency As String
    Dim lngUrgency As Long

    'Get the contents of the formfields
    strUrgency = oDoc.FormFields("Dropdown5").Result

    'Get UrgencyId from Urgency Name by looking it up
    lngUrgency = DLookup("[id_urgency]", "Urgency", "[desc_urgency] = '"
    & strUrgency & "'")

    ok. the question is that one of the formfields says if this was the first
    time that happened to the machine (as it is a computer repair request), so
    they can choose Yes or no. Now, in my main table for the database, this field
    is a Yes/No field. so, I'm not sure if I can set it as the other ones (string
    - long) or what is the correct "dim" that I have to put to that variable so
    when I add a new record afterwards to my database that field is checked if it
    says yes, and it is not checked if it says no....

    then I have to see how I deal with the adding records part, but John Nurick
    was helping me with that, although I'm having trouble with that as well...
    jaja.

    hope this was a little bit more explainatory, so you can help me again!

    thank you again for taking your time to help me. I really appreciate it.




    "Ofer" wrote:

    > I'm not sure if you want to return this two fields, or filter on them
    >
    > To return to fields combined, you can use the dlookup as follows
    >
    > =DlookUp("[Field1] & [Field2]","TableName","Field1='Value'")
    > ===========================================
    > To filter on a Yes/No field
    > =DlookUp("[Field1]","TableName","Field1=True")
    > Or , use false
    > ===========================================
    > To filter on two fields on the same time
    > =DlookUp("[Field1]","TableName","Field1='Value' And Field2 = True")
    >
    > or with parameter
    > =DlookUp("[Field1]","TableName","Field1='" & Value & "' And Field2 = True")
    >
    > Mybe one of the example answered your question, or if Im in the right
    > direction then please tell me if you need any more help
    >
    > --
    > I hope that helped
    > Good Luck
    >
    >
    > "lula" wrote:
    >
    > > hi.... I have a question... the other day "ofer" helped me with a dlookup
    > > syntax and I have one more question...
    > >
    > > I'm importing the fields of a word document into my database and I'm convert
    > > each part of the word doc into the id value of my tables in my database.
    > >
    > > ie: in the word doc I have urgency: average
    > > in my database I have a Urgency table where the "average" id is 1.
    > >
    > > and in code I'm grabbing that "average" and With the dlookup I look for the
    > > "average" id, so it brings me the #: 1.
    > >
    > > Now, here is the question... I have 2 fields in my database that are Yes/No
    > > fields. how do I do it with those 2 fields???
    > >
    > > I hope someone understand what I need and can help me.....
    > >
    > > thank you for your help in advance!
    > >
    > >
    > >
    > >
     
  4. Ofer

    Ofer
    Expand Collapse
    Guest

    You define this field as
    Dim MyVar As Boolean

    And the field in the table will return True Or False

    MyVar = Dlookup("YesNoField","TableName","Where condtion")
    If MyVar = True Then
    ' checked
    else
    ' Not checked
    End if


    --
    I hope that helped
    Good Luck


    "lula" wrote:

    > thank you ofer for your help, but actually I don't know what I need.. jaja.
    >
    > let me explain myself again, cos I don't think it's any of the options you
    > gave me.
    >
    > I have a word doc for computer repair requests with formfields where the
    > people choose an option from. (ie: urgency could be: low, average or high)
    > In my database, I have tables that codifies those options (Urgency table has
    > id_urgency and desc_urgency)
    >
    > so far I'm trying to grab those formfields like this:
    >
    > Dim strUrgency As String
    > Dim lngUrgency As Long
    >
    > 'Get the contents of the formfields
    > strUrgency = oDoc.FormFields("Dropdown5").Result
    >
    > 'Get UrgencyId from Urgency Name by looking it up
    > lngUrgency = DLookup("[id_urgency]", "Urgency", "[desc_urgency] = '"
    > & strUrgency & "'")
    >
    > ok. the question is that one of the formfields says if this was the first
    > time that happened to the machine (as it is a computer repair request), so
    > they can choose Yes or no. Now, in my main table for the database, this field
    > is a Yes/No field. so, I'm not sure if I can set it as the other ones (string
    > - long) or what is the correct "dim" that I have to put to that variable so
    > when I add a new record afterwards to my database that field is checked if it
    > says yes, and it is not checked if it says no....
    >
    > then I have to see how I deal with the adding records part, but John Nurick
    > was helping me with that, although I'm having trouble with that as well...
    > jaja.
    >
    > hope this was a little bit more explainatory, so you can help me again!
    >
    > thank you again for taking your time to help me. I really appreciate it.
    >
    >
    >
    >
    > "Ofer" wrote:
    >
    > > I'm not sure if you want to return this two fields, or filter on them
    > >
    > > To return to fields combined, you can use the dlookup as follows
    > >
    > > =DlookUp("[Field1] & [Field2]","TableName","Field1='Value'")
    > > ===========================================
    > > To filter on a Yes/No field
    > > =DlookUp("[Field1]","TableName","Field1=True")
    > > Or , use false
    > > ===========================================
    > > To filter on two fields on the same time
    > > =DlookUp("[Field1]","TableName","Field1='Value' And Field2 = True")
    > >
    > > or with parameter
    > > =DlookUp("[Field1]","TableName","Field1='" & Value & "' And Field2 = True")
    > >
    > > Mybe one of the example answered your question, or if Im in the right
    > > direction then please tell me if you need any more help
    > >
    > > --
    > > I hope that helped
    > > Good Luck
    > >
    > >
    > > "lula" wrote:
    > >
    > > > hi.... I have a question... the other day "ofer" helped me with a dlookup
    > > > syntax and I have one more question...
    > > >
    > > > I'm importing the fields of a word document into my database and I'm convert
    > > > each part of the word doc into the id value of my tables in my database.
    > > >
    > > > ie: in the word doc I have urgency: average
    > > > in my database I have a Urgency table where the "average" id is 1.
    > > >
    > > > and in code I'm grabbing that "average" and With the dlookup I look for the
    > > > "average" id, so it brings me the #: 1.
    > > >
    > > > Now, here is the question... I have 2 fields in my database that are Yes/No
    > > > fields. how do I do it with those 2 fields???
    > > >
    > > > I hope someone understand what I need and can help me.....
    > > >
    > > > thank you for your help in advance!
    > > >
    > > >
    > > >
    > > >
     

Share This Page