Textbox Question

Christine5017

Registered User.
Local time
Today, 02:27
Joined
Mar 7, 2002
Messages
10
I would like to have a text box that counts how many times we have added a client in a form. ( EX: I just keyed in a textbox Bob's Place. In the next text box will be a number 3 which shows that we have this client in the database 3 times with information.) Is there a way that this can be done? If so, could you please tell me. Thank You
 
Sub "On Entry Of Name"
Dim db As Database
Dim rsSearch1 As DAO.Recordset
Dim vName as String
Dim Counter as long
Counter = 0
vName = txtName
Set rsSearch1 = db.OpenRecordset("tblName", dbOpenDynaset)
rsSearch1.Movefirst
rsSearch1.FindFirst "[fldName] = '" & vName & "'"
Do While NOT(rsSearch.EOF)
If rsSearch1.NoMatch Then
Else
Counter = Counter + 1
End if
rsSearch1.FindNext "[tblName] = '" & vName & "'"
Loop
rsSearch1.Close
txtBoxCounter = Counter
Exit Sub
 
Last edited:

Users who are viewing this thread

Back
Top Bottom