M
Matt.
Hi all!
The code below fails on the first Execute. Can somebody please tell me what
I'm doing wrong? I'm going to base the results in the table
TrainingModulesNotTaken for a report, otherwise I'd use recordsets for all
this.
cheers,
Matt.
Public Sub ModuleNotTakenA(ClockNumber As Integer)
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String
strSQL = "Create View vwEmpModules AS " _
& "Select Distinct [Clock Number], Module From [Employee Training] " _
& "WHERE [Clock Number] = " & CStr(ClockNumber) & ";"
Set conn = CurrentProject.Connection
conn.Execute strSQL
strSQL = "Delete * " _
& "From TrainingModulesNotTaken ;"
conn.Execute strSQL
strSQL = "Insert Into TrainingModulesNotTaken (Module, Description, [Clock
Number]) " _
& "Select Module, Description, " & ClockNumber & " " _
& "From Module " _
& "Where Module NOT IN (SELECT Module FROM vwEmpModules);"
conn.Execute strSQL
Set rs = Nothing
Set conn = Nothing
End Sub
The code below fails on the first Execute. Can somebody please tell me what
I'm doing wrong? I'm going to base the results in the table
TrainingModulesNotTaken for a report, otherwise I'd use recordsets for all
this.
cheers,
Matt.
Public Sub ModuleNotTakenA(ClockNumber As Integer)
Dim conn As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strSQL As String
strSQL = "Create View vwEmpModules AS " _
& "Select Distinct [Clock Number], Module From [Employee Training] " _
& "WHERE [Clock Number] = " & CStr(ClockNumber) & ";"
Set conn = CurrentProject.Connection
conn.Execute strSQL
strSQL = "Delete * " _
& "From TrainingModulesNotTaken ;"
conn.Execute strSQL
strSQL = "Insert Into TrainingModulesNotTaken (Module, Description, [Clock
Number]) " _
& "Select Module, Description, " & ClockNumber & " " _
& "From Module " _
& "Where Module NOT IN (SELECT Module FROM vwEmpModules);"
conn.Execute strSQL
Set rs = Nothing
Set conn = Nothing
End Sub