Consulting

Results 1 to 4 of 4

Thread: Finding Duplicates

  1. #1
    VBAX Regular
    Joined
    Nov 2018
    Posts
    41
    Location

    Finding Duplicates

    When a number is typed on a form I want to immediately check whether it already exists in the database. Can this be done through code?


    Also when my code is lang I want to display "Please wait..." and when my code finishes it should vanish. How to do it?

  2. #2
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Yes it can be done, you use parameter SQL as a recordset and if the recordcount is not zero the record already exists.
    here is an example

    Dim SQL As String
    
     SQL = "SELECT Que_CallNumber.* " & _
      "FROM Que_CallNumber " & _
      "WHERE DealerCode = " & Me.Dealercode
      Set rs = CurrentDb.OpenRecordset(SQL)
      If rs.RecordCount <> 0 Then
    As to your second question, really the code shouldn't take that long but there are 2 ways to do this
    1. Use the Form's "Status Bar" with
    Forms("frmImport").cmdGetSource.StatusBarText = "Please Wait "
    and
    Forms("frmImport").cmdGetSource.StatusBarText = ""

    2. Create a Label on the form with your message, set it to Visible = No and change it to Visible = Yes to see it and then Visible = No to hide it again.

  3. #3
    VBAX Regular
    Joined
    Nov 2018
    Posts
    41
    Location
    Thanks a Lot!!! GOD BLESS YOU!!!

  4. #4
    VBAX Guru
    Joined
    Mar 2005
    Posts
    3,296
    Location
    Your welcome.

Tags for this Thread

Posting Permissions

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