Results 1 to 5 of 5
  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

    Change Criteria to Variable? (A2k (9.0.3821) SR-1)

    Change Criteria to Variable?
    A2k (9.0.3821) SR-1

    The following function code works as is, however I want to make this function to be variable driven and can

  2. #2
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Criteria to Variable? (A2k (9.0.3821) SR-1)

    John,

    I think this is the correct syntax:

    "[ProductName]"

    I believe you only need the square brackets if your field name has spaces in it.

    <A target="_blank" HREF="http://www.mvps.org/access/general/gen0018.htm">There

  3. #3
    5 Star Lounger
    Join Date
    Jan 2001
    Location
    Newbury, Berkshire, England
    Posts
    712
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Change Criteria to Variable? (A2k (9.0.3821) SR-1)

    >>>>>>>>>>>>>>.I think this is the correct syntax:

    "[ProductName]" <<<<<<<<<<<<<<<<<<

    I

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

    Re: Change Criteria to Variable? (A2k (9.0.3821) SR-1)

    Hi Rupert

    I'm calling the function with the following, field value, field name and table name

    CheckForGapInSequence([strPermitNo],"strPermitNo","tblBPermit")

    Public Function CheckForGapInSequence(strFieldValue As String, _
    strFieldName As String, strTableName As String) As String

    Dim strLookup As String
    strLookup = strFieldValue

    If IsNull(DLookup(strFieldName, strTableName, "strPermitNo= '" & strLookup & "'")) Then

    In the above statement, I want to remove the hard coded strPermitNo and replace it with strFieldName but can't figure out the correct quote syntax.

    Thanks, John

  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: Change Criteria to Variable? (A2k (9.0.3821) SR-1)

    Hi Rupert


    This finally got it!

    If IsNull(DLookup("[" & strFieldName & "]", "[" & strTableName & "]", _
    "[" & strFieldName & "] = '" & strCriteria & "'")) Then

    Thanks for help, 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
  •