G
Guest
I have two tables in my database. One is called NewAppointments and the
other is called newTelesales.
I am trying to read all records in the newAppointments table, and also
simultaneously read all records in the newTelesales table. When a record
from the newTelesales table matches a record from the newAppointments table,
then I want to update a field called notes in the newAppointments table with
the newTelesales Notes field details.
I have written the following code but it keeps going in a loop I presume, as
pc just crashes.
Private Sub Command0_DblClick(Cancel As Integer)
Dim dbNewdb As DAO.Database
Dim rcdTelesales As DAO.Recordset
Dim rcdAppointments As DAO.Recordset
Dim numHold As Integer
Dim strMove As String
Set dbNewdb = CurrentDb
Set rcdTelesales = dbNewdb.OpenRecordset("NewTelesales")
Set rcdAppointments = dbNewdb.OpenRecordset("NewAppointments")
rcdAppointments.MoveFirst
Do Until rcdAppointments.EOF
numHold = rcdAppointments![TeleSalesID]
With rcdTelesales
.MoveFirst
If rcdTelesales.EOF = False And rcdTelesales.BOF = False Then
Do While rcdTelesales.EOF = False
If rcdTelesales![TeleSalesID] = numHold Then
strMove = rcdTelesales![Notes]
.MoveNext
End If
Loop
End If
End With
rcdAppointments.Edit
rcdAppointments![Notes] = strMove
rcdAppointments.Update
rcdAppointments.MoveNext
Loop
End Sub
Any help appreciated
Thanks Ronnie
other is called newTelesales.
I am trying to read all records in the newAppointments table, and also
simultaneously read all records in the newTelesales table. When a record
from the newTelesales table matches a record from the newAppointments table,
then I want to update a field called notes in the newAppointments table with
the newTelesales Notes field details.
I have written the following code but it keeps going in a loop I presume, as
pc just crashes.
Private Sub Command0_DblClick(Cancel As Integer)
Dim dbNewdb As DAO.Database
Dim rcdTelesales As DAO.Recordset
Dim rcdAppointments As DAO.Recordset
Dim numHold As Integer
Dim strMove As String
Set dbNewdb = CurrentDb
Set rcdTelesales = dbNewdb.OpenRecordset("NewTelesales")
Set rcdAppointments = dbNewdb.OpenRecordset("NewAppointments")
rcdAppointments.MoveFirst
Do Until rcdAppointments.EOF
numHold = rcdAppointments![TeleSalesID]
With rcdTelesales
.MoveFirst
If rcdTelesales.EOF = False And rcdTelesales.BOF = False Then
Do While rcdTelesales.EOF = False
If rcdTelesales![TeleSalesID] = numHold Then
strMove = rcdTelesales![Notes]
.MoveNext
End If
Loop
End If
End With
rcdAppointments.Edit
rcdAppointments![Notes] = strMove
rcdAppointments.Update
rcdAppointments.MoveNext
Loop
End Sub
Any help appreciated
Thanks Ronnie