Results 1 to 2 of 2
  1. #1
    Join Date
    Mar 2004
    Posts
    83

    Unanswered: Checking for Duplicates

    I would like to have one of my fields be checked for duplicates in the DB before the focus switches over to the next control. I was thinking about running an SQL query based the value entered.

    The question is, how do I go about executing a query which I could get the count of the records it found. For example...

    Dim count As Integer
    count = <some code to execute a query>

    If count > 1 Then
    yadayada
    End If

  2. #2
    Join Date
    Feb 2004
    Posts
    142
    Quote Originally Posted by High_D
    I would like to have one of my fields be checked for duplicates in the DB before the focus switches over to the next control. I was thinking about running an SQL query based the value entered.

    The question is, how do I go about executing a query which I could get the count of the records it found. For example...

    Dim count As Integer
    count = <some code to execute a query>

    If count > 1 Then
    yadayada
    End If
    DCount("[FieldName]","tableName","[FieldName] = " & [ControlName]) if the field is numeric or
    DCount("[FieldName]","tableName","[FieldName] = '" & [ControlName] & "'")
    if the field is a string use # if it is a date
    KC

Posting Permissions

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