SQL in VBA

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I'm trying to run this statement:

DoCmd.RunSQL "INSERT INTO ArchivedTxPlan ( TxPlanProblemID )SELECT
DISTINCTROW TxPlan.TxPlanProblemID, * FROM TxPlan WHERE
TxPlan.TxPlanProblemID =" & Me![HoldTxProblemID] & " ;"
But I keep getting this error:

Runtime error '3162'
You tried to assign a Null value to a variable that isn't a Variant data type.

I dont get it....
 
I can't explain the error you're getting, but the SQL statement does not
look right to me. The "*" is almost certainly wrong. Maybe it should look
like this:

INSERT INTO ArchivedTxPlan (txPlanProblemID)
SELECT DISTINCTROW txPlan.txPlanProlemID
FROM TxPlan
WHERE txPlanProblemID="xxx"

You should also look at the specific value in ME!HoldProblemID.

Hope this helps.
Dom
 
Back
Top