I would first like to thank you for attempting to help me with my problem. I am attempting to store information entered into a text box into the following fields [ProjectName], [ProjectDate], [ProjectLeader] within my Project table. The textbox information will be separated by comma's. I would like the following text to enter into the appropriate fields "25 May 2015,Wildlife Strategy,John Doe".
Here is the code I have so far:
Private Sub Submit_Click()
Dim textPhrase As String
Dim words() As String
Dim i As Integer
Dim Query As QueryDefs
textPhrase = phrase
words = Split(textPhrase, ",")
SQL = "parameters P1 text;INSERT INTO [Project] (ProjectDate, ProjectName, ProjectLeader) VALUES ([P1])"
Set Query = CurrentDb.CreateQueryDef("FsInsert", SQL)
For i = LBound(words) To UBound(words)
qdf.Parameters("P1").Value = words(i)
qdf.Execute
Next i
CurrentDb.QueryDefs.Delete ("FsInsert")
End Sub
I keep getting the error code, "Number of query values and destination fields are not the same".
Any help is appreciated.