I have a form that the user creates a new record in the DB
He types a Claimnumber in a box then retypes in a second box and I check that they match so I know he hasn't made a typo. However I also must check that the Claimnumber isn't already in the db. Here is the partial code when he clicks a cmdbutton.
VB Code:
Dim cn As ADODB.Connection Dim rs As ADODB.Recordset Set cn = New ADODB.Connection Set rs = New ADODB.Recordset cn.ConnectionString = "DSN=eDoan;UID=sa" cn.Open rs.Open "Select ClaimNo from tblClaim Where ClaimNo = '" & txtRetypeClaimNo.Text & "'", cn, adOpenDynamic, adLockPessimistic If rs.EOF And rs.BOF And txtFields(1) = txtRetypeClaimNo Then go on with the process Else MsgBox etc
It works just fine with no problems. However as the DB grows it will take longer and longer to check for no duplicate Claimnumber. My question is can I somehow code this to only check the last 4000 records in the DB ?
Thanks for any help




Reply With Quote