PDA

View Full Version : Finding Duplicates



Kundan
12-10-2018, 01:21 AM
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?

OBP
12-10-2018, 02:49 AM
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.

Kundan
12-10-2018, 09:32 PM
Thanks a Lot!!! GOD BLESS YOU!!!

OBP
12-11-2018, 02:43 AM
Your welcome.