I have been trying for the last two days to get this piece of code working:
However I am having no luck.
I need to use the names in table "one" With the first name and go and see if exists in table "two".
If there is a match(s) It then ticks a box for every match found.
Once it has finished searching for the first name in table one, I then need it to move onto the second name in table one and search table two again etc etc.
Public Sub GetLName()
Dim dbMonthlyReports2000 As DAO.Database
Dim rst As DAO.Recordset
Dim strCritera, strCritera2 As String
Dim rst, rst1
Set dbMonthlyReports2000 = CurrentDb
Set rst = dbMonthlyReports2000.OpenRecordset("CB_March_2004" , dbOpenDynaset)
Set rst1 = dbMonthlyReports2000.OpenRecordset("CBSearch", dbOpenDynaset)
Do Until rst.EOF
strCritera = rst!Surname
rst1.FindFirst rst1!Customer = strCritera
Do Until rst1.NoMatch
If rst1!customer = strCritera Then
rst1!Buy = True
rst1.FindNext rst1.customer = strCritera
Download for FREE the ADO/DAO Data Controls that makes life EASIER developing database applications in: VB, FoxPro, Access, VC++, .NET etc... Navigate, Add New, Delete, Update, Search, Undo and Save your changes. Supports Disconnected Recordsets and Transactions!
Or try our Ask An Expert service to answer any of your questions!