SQL Query 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 don't know whether it's the cause of your problem, but you're saying that
you're only going to be insert one field (TxPlanProblemId) into the table
ArchivedTxPlan, but your subselect statement appears to be extracting more
than one field (SELECT Tx.Plan.TxPlanProblemId, * ...)
 
Back
Top