L
LilMorePlease
I am working on a delete batch form that simply deletes assigned batches for
users. The records that need to be deleted are in the assignedbatches table.
I have only a little experience with delete queries, but this works in the
Access QDG:
DELETE AssignedBatches.*, Employee.UserId
FROM Employee INNER JOIN AssignedBatches ON
Employee.EmpNum=AssignedBatches.EmpNum
WHERE (((Employee.UserId)=Forms!DeleteBatch!txtuserid));
Rather than having a saved query, I'd rather create a temporary one in VBA
to execute on command. However, I am getting error 3061 - Too few
parameters. Expected 1. using the following vba:
strSQL = "DELETE AssignedBatches.*, Employee.UserId" & _
"FROM Employee INNER JOIN AssignedBatches ON
Employee.EmpNum=AssignedBatches.EmpNum" & _
strCriteria = "WHERE (((Employee.UserId)=Forms!DeleteBatch!txtuserid));"
Set qdf = CurrentDb.CreateQueryDef("View by UserId", strSQL & strCriteria)
qdf.Execute
What am I doing wrong?
Thanks in advance,
AA
users. The records that need to be deleted are in the assignedbatches table.
I have only a little experience with delete queries, but this works in the
Access QDG:
DELETE AssignedBatches.*, Employee.UserId
FROM Employee INNER JOIN AssignedBatches ON
Employee.EmpNum=AssignedBatches.EmpNum
WHERE (((Employee.UserId)=Forms!DeleteBatch!txtuserid));
Rather than having a saved query, I'd rather create a temporary one in VBA
to execute on command. However, I am getting error 3061 - Too few
parameters. Expected 1. using the following vba:
strSQL = "DELETE AssignedBatches.*, Employee.UserId" & _
"FROM Employee INNER JOIN AssignedBatches ON
Employee.EmpNum=AssignedBatches.EmpNum" & _
strCriteria = "WHERE (((Employee.UserId)=Forms!DeleteBatch!txtuserid));"
Set qdf = CurrentDb.CreateQueryDef("View by UserId", strSQL & strCriteria)
qdf.Execute
What am I doing wrong?
Thanks in advance,
AA