Darrell Wootton
Registered User.
- Local time
- Today, 14:45
- Joined
- Feb 22, 2002
- Messages
- 14
Hi,
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.Edit
rst1!Buy = True
rst1.Update
Else
End If
rst1.FindNext rst1.customer = strCritera
Loop
rst.MoveNext
Loop
rst.Close
rst1.Close
dbMonthlyReports2000.Close
End Sub
Thanks in advance
Darrell......
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.Edit
rst1!Buy = True
rst1.Update
Else
End If
rst1.FindNext rst1.customer = strCritera
Loop
rst.MoveNext
Loop
rst.Close
rst1.Close
dbMonthlyReports2000.Close
End Sub
Thanks in advance
Darrell......