Hi Guys,
I'm receiving the run-time error '3141' - The SELECT statement includes a reserved word or an argument name..."
Here's the full code...
Does anyone see a problem with this code that would cause this?
Thanks,
I'm receiving the run-time error '3141' - The SELECT statement includes a reserved word or an argument name..."
Here's the full code...
Code:
Dim db As DAO.Database
Dim rst As DAO.Recordset
Dim strSQL As String
Set db = CurrentDb
strSQL = "SELECT TOP " & Me.Text140.Value & " [CAN - NAME].Name, [CAN - CPT/VOUCHER].Voucher_Number, " & _
"[CAN - CPT/VOUCHER].Procedure_Code, [CAN - CPT/VOUCHER].Service_Date_From, [CAN - CPT/VOUCHER].Patient_ID, [CAN - CPT/VOUCHER].service_id, Rnd([service_id]) AS RandomNum " & _
"INSERT INTO [Group1-CAN Top]" & _
"FROM [CAN - CPT/VOUCHER], [CAN - NAME] WHERE [CAN - CPT/VOUCHER].Service_Date_From Between '" & Me.StartDate.Value & "' And '" & Me.EndDate.Value & "' ORDER BY Rnd([service_id]) DESC "
Set rst = db.OpenRecordset(strSQL)
Set db = Nothing
Set rst = Nothing
Does anyone see a problem with this code that would cause this?
Thanks,