Hi All,
I'm trying to append to a table. The table layout is as follows:
TableName: WeeklyRpt
Fields:
ID AutoNumber
ReportId Number
ProjectId Number
PM Text
....
The code I'm using to perform this (or trying to perform :-( ):
Private Sub CreateReportSet(RptId As Long)
Dim myDb As Database
Dim strSQL As String
Dim strClosed As String
If RptId = 0 Then
Exit Sub
End If
Set myDb = CurrentDb
strClosed = """Closed"""
strSQL = "INSERT INTO WeeklyRpt (ReportId, ProjectId, PM) " & _
"SELECT " & CStr(RptId) & " , Projects.ProjectId, Projects.PM " & _
"FROM Projects " & _
"WHERE IsNull([Last Report]) " & _
"OR [Last Report] <> " & strClosed & " " & _
"OR ([Last Report] = " & strClosed & " AND [Revised Completion Date] > #12/31/2003#);"
myDb.Execute strSQL
Set myDb = Nothing
End Sub
Using Debug I can see that the RptId value is set, but I still get the following error message:
Run-time error '3061': Too few parameters. Expected 1
Instead of using the IsNull function, I've also tried "WHERE [Last Report] IS NULL", but that has the same result.
Any ideas?
The rebel without a clue -
vandalen@iname.com