We help IT Professionals succeed at work.
Get Started

Error inserting data from record into another Table

Tom Crowfoot
Tom Crowfoot asked
Last Modified: 2015-03-31

I have a piece of code which I thought would add a new record to another table. The database has 2 main tables (People, which is where the data comes from) and PeopleOnAssignments which is where I want the data added to - this table has 4 fields in it:

ID (Autonunber)
PersonID (Number)
AssignmentID (Number)
Status (Text, but its not used in this part )

Dim PeopleID1 As String
Dim AssignmentID1 As String
PeopleID1 = Me.ID
AssignmentID1 = Me.AssLookupCombo.Value

Dim strSQL As String
strSQL = "INSERT INTO PeopleOnAssignments ([PersonID],[AssignmentID]) Values(PeopleID1 , AssignmentID1)"
CurrentDb.Execute strSQL, dbFailOnError

Open in new window

The error I keep getting is 3061 - Too few parameters. Expected 2

Can anyone help
Watch Question
Most Valuable Expert 2015
Distinguished Expert 2018
This problem has been solved!
Unlock 1 Answer and 3 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE