CurrentDBExecute. Added filed now not working

pp8082

Registered User.
Local time
Today, 10:33
Joined
Jan 27, 2013
Messages
29
Hi,
I really need help with this.

I added a new field to a table.
Changed the CurrentDB.Execute statement to include it. Now I am getting a run time error 3061 , Too few parameters. Expected 1 .

Code before the change.
CurrentDb.Execute "INSERT INTO signals ([datedaily], sw, c )VALUES (#" & mydate & "#, " & BuyFlag & ", " & rut & " ;"

Code after change.

CurrentDb.Execute "INSERT INTO signals ([datedaily], sw, c, BuyOrSell)VALUES (#" & mydate & "#, " & BuyFlag & ", " & rut & ", " & trade & ");"

What is wrong with it?
 
I recommend the following debugging tip.

-Dim a string variable to hold your sql eg mySQL
-Assign your sql to the variable
-Insert a Debug.print mySQL which will print the rendered sql in the immediate window
(You can often see a syntax error in the rendered sql)
(If there is no obvious error, you can copy the sql and paste it into SQL view of the query wizard and try to run it)
- Change your Currentdb.Execute to
CurrentDB.execute mySQL, dbFailOnError which will give an error message only if an error occurs
 
Hi,
I was travelling and could not respond. But I tried the following.
I am getting nowhere

Dim mysql As String
mysql = " INSERT INTO Signals ([datedaily], sw, c) " & _
"VALUES (#" & mydate & "#, " & BuyFlag & ", " & rut & ");"
--------------------------------------------------------------------------
I put a debug.print and this is what I got.


The values for date, sw, and c are :
7/31/2000 0 500.64

The debug.print for the SQL returns:
INSERT INTO Signals ([datedaily], sw, c) VALUES (#12:00:00 AM#, 0, 0);
 
Can you post a copy of your database? Remove anything confidential/private. Some details about specific issues would help readers as well.
 

Users who are viewing this thread

Back
Top Bottom