Results 1 to 7 of 7
  1. #1
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Need Correct Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I have the following code that was indicating an strRefNo was on file even though it wasn

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Correct Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    A string (text) value must be surrounded by quotes. To include quotes in a quoted string, you can use
    a) single quotes ' or
    [img]/forums/images/smilies/cool.gif[/img] double double quotes "" or
    c) the expression Chr(34)

    Without knowing what the role of strTranCode2 is, I cannot tell whether you need it or not in your expression.

  3. #3
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Correct Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Hans

    strTranCode2 is a 1 character text field

    Thanks, John

  4. #4
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Correct Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Thanks, but that doesn't tell me anything about why you would need it in this expression.

  5. #5
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Correct Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    I have a Continous Form entering line the following item:

    <pre>strTranCode2 strRefNo
    M 2006-001
    </pre>


    In the strRefNo_BeforeUpdate, I want to prevent the operator from entering strTranCode2 M and strRefNo 2006-001 if it is already in the the underlying table tbl_RevTran_Detail

  6. #6
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Need Correct Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    In that case, your (revised) code should do what you want. You could also use this:
    <code>
    If DCount("*", "tbl_RevTran_Detail", "strRefNo=" & Chr(34) & _
    Me.strRefNo & Chr(34) & " AND strTranCode2=" & _
    Chr(34) & Me.strTranCode2 & Chr(34)) > 0 Then</code>

  7. #7
    Silver Lounger
    Join Date
    Jun 2001
    Location
    Niagara Falls, New York, USA
    Posts
    1,878
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Need Correct Syntax? (a2k (9.0.6926) SP-3 Jet 4.0 SP-8)

    Hans

    I like you solution, syntax is easier to read and fewer quotes which can be very confusing

    Thanks, John

Posting Permissions

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