I have no idea?! How would I check that?
Here is the code in its entirity
Code:
Dim ID(10) As String
Dim CtcName(10) As String
Dim Title(10) As String
Dim Address(10) As String
Dim Phone(10) As String
Dim Interviewed(10) As String
Dim DM(10) As String
Dim Sql, SqlInsert, SqlValues As String
Dim i, j, NumCtcs As Integer
Dim dbConn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
DoCmd.SetWarnings False
Set dbConn = Application.CurrentProject.Connection
Rs.Open "SELECT * FROM tbl_ct WHERE AID = " & Me.txtAID & ";", dbConn, adOpenForwardOnly, adLockReadOnly
DoCmd.RunSQL "DELETE * FROM tbl_Clist WHERE AID = " & Me.txtAID & ";"
i = 1
While Not Rs.EOF
If (i <= 10) Then
ID(i) = Rs("ID")
CtcName(i) = Rs("Sal") & " " & Rs("FName") & " " & Rs("LName")
If (Rs("Title") <> "") Then Title(i) = Rs("Title") Else Title(i) = "No Title Captured"
Address(i) = Rs("Address1") & ", " & Rs("City") & ", " & Rs("State") & ", " & Rs("Zip")
If (Rs("Phone_Main") <> "") Then Phone(i) = Rs("Phone_Main") Else Phone(i) = "No Direct Phone"
If (Rs("Interviewed") <> "") Then Interviewed(i) = Rs("Interviewed") Else Interviewed(i) = "No"
If (Rs("DM") <> "") Then DM(i) = Rs("DM")
End If
NextContact:
i = i + 1
Rs.MoveNext
Wend
j = i
i = 0
If j > 10 Then j = 10
NumCtcs = Me.txtNumCtcs
While i <= j
If (DM(i) = "Dead") Then
If i < 10 Then
NumCtcs = NumCtcs - 1
ID(i) = ID(i + 1)
CtcName(i) = CtcName(i + 1)
Title(i) = Title(i + 1)
Address(i) = Address(i + 1)
Phone(i) = Phone(i + 1)
Interviewed(i) = Interviewed(i + 1)
DM(i) = DM(i + 1)
End If
End If
i = i + 1
Wend
i = 0
Sql = "INSERT INTO tbl_Clist "
SqlInsert = "(AID"
SqlValues = ") VALUES(" & Me.txtAID
While i < NumCtcs
i = i + 1
SqlInsert = SqlInsert & ",Xtel_" & i & ",Name_" & i & ",Title_" & i & ",Address_" & i & ",Phone_" & i & ",Interviewed_" & i & ",DM_" '& i
SqlValues = SqlValues & "," & ID(i) & ",'" & CtcName(i) & "','" & Title(i) & "','" & Address(i) & "','" & Phone(i) & "','" & Interviewed(i) & "','" & DM(i) & "'"
Wend
Sql = Sql & SqlInsert & SqlValues & ");"
Me.Text5 = Sql
DoCmd.RunSQL Sql
DoCmd.SetWarnings True
Rs.Close
dbConn.Close
Set Rs = Nothing