Hi,
Can somebody help me out with the syntax with this? I am trying to run an insert into sql command on a form. I was able to get the following code to run correctly. QuestID is a Number value.
Code:
DoCmd.RunSQL "INSERT INTO tblQuestions ( Question, QuestionCode )SELECT tblQuestionsLinked.Question, tblQuestionsLinked.QuestionCode FROM tblQuestionsLinked WHERE tblQuestionsLinked.QuestID = " & Me.QuestID
When I try to run the following similar code with QuestionCode as the WHERE parameter (which is a text value) I am getting a popup window that says "Enter Parameter Value" with the Me.QuestionCode value showing in the window and a blank field. If I type the Me.QuestionCode Value into the blank field it then appends the data to the table. I assume I need to adjust this second set of code somewhat to account for the fact that Me.QuestionCode is a text value. Can somebody help me out with the syntax on this second code? Thanks.
Code:
DoCmd.RunSQL "INSERT INTO tblQuestions ( Question, QuestionCode )SELECT tblQuestionsLinked.Question, tblQuestionsLinked.QuestionCode FROM tblQuestionsLinked WHERE tblQuestionsLinked.QuestionCode = " & Me.QuestionCode