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, * ...)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top