Senin, 26 September 2011

[MS_AccessPros] Insert Into Syntax help

 

Hello friends!

John Viescas, nice to see you posting. Hope you had a good time doing whatever you were off doing.

I'm trying to capture a value from a form and a calculated value and save them into a table using Insert Into but can't seem to get the syntax correct. I've verified both values as working correctly through the immediate window, however I can't seem to save them in a table. The table has only 2 fields, ID and Contestant. I'm using the following code:

'Save word to WordsDrawn Table
Dim intWDID As Integer
Dim strWord As String
Dim strSQL As String

intWDID = Nz(DMax("ID", "WordsDrawn") + 1, 1)
Debug.Print intWDID

strWord = Me.txtName
Debug.Print strWord
strSQL = "Insert INTO [WordsDrawn](ID, Contestants) Values (intWDID, strWord)"
Debug.Print strSQL

Dim db As DAO.Database
'Point to this database
Set db = CurrentDb

CurrentDb.Execute strSQL, dbFailOnError

When I execute this code I get a runtime error 3601: Too few parameters. Expected 2.

I appreciate any help.

Doyce

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar