! HELP ! Inserting into Table -> Error: 3061 
Author Message
 ! HELP ! Inserting into Table -> Error: 3061

I am programming in VB 5 and using an Access- DB.
I have terrribly problems with INSERTING into a table which already
exists (Patstamm) in an ACCESS- DB.
My Code looks like this:

Type leist
    .name As String
    .gebdat As String
    .blutgr As String
    .werEin As Integer
    ......
    .refNr As Integer
End Type

.....
qd= Set db.CreateQueryDef("")
qd.SQL= "INSERT INTO patstamm (pnr,aufn,svnr,kisnr,eindat,klasse,refNr,"
_
        +"wannein,werein,bergeben) "
        +"VALUES (leist.pnr,leist.aufn,.........leist.bergeben)"
qd.Execute

So the numbers of paramters of the insert statement are exactly the same
as in the values statement. The leist- Type got filled with values from
other tables with SELECT statements & using Recordset- Objects,....
before this statements and some of them must be allowed to contain null-
Values (empty strings).
e.g. klasse . Pnr and werein is not allowed to be null.

When I run my program, VB 5 reports: "Runtime Error 3061: too few
parameters expected: 10". Note: I have already checked, that all fields
which are not allowed to be null in the table are filled with values.
e.g. leist.pnr

What is wrong with the number of parameters ???????????
!!!!!!!!!!!!!!!!!!Please help me !!!!!!!!!!!!!
How can I get ride off this error message so that my program would like
to work
Its is really urgent !

Thanks
Nina.

[ Attached Message ]

From:
To:
Date: Wed, 2 Dec 1998 14:40:58 -0500
Local: Wed, Dec 2 1998 2:40 pm
Subject: Saving the state of you program
I have an application which uses many DataCombo controls
with the list items linked to a database.

HOW can I allow the user to select items and then next
time the app is opened all controls come up as they were
before the app was closed.

Catch,,,,  I need to get to the row of the database table
which the user selected in the DataCombos so I can
read other initializing values..

Please respond...

Thanks,

Cliff Jones



Sat, 26 May 2001 03:00:00 GMT  
 ! HELP ! Inserting into Table -> Error: 3061

I am programming in VB 5 and using an Access- DB.
I have terrribly problems with INSERTING into a table which already
exists (Patstamm) in an ACCESS- DB.
My Code looks like this:

Type leist
    .name As String
    .gebdat As String
    .blutgr As String
    .werEin As Integer
    ......
    .refNr As Integer
End Type

.....
qd= Set db.CreateQueryDef("")
qd.SQL= "INSERT INTO patstamm (pnr,aufn,svnr,kisnr,eindat,klasse,refNr,"
_
        +"wannein,werein,bergeben) "
        +"VALUES (leist.pnr,leist.aufn,.........leist.bergeben)"
qd.Execute

So the numbers of paramters of the insert statement are exactly the same
as in the values statement. The leist- Type got filled with values from
other tables with SELECT statements & using Recordset- Objects,....
before this statements and some of them must be allowed to contain null-
Values (empty strings).
e.g. klasse . Pnr and werein is not allowed to be null.

When I run my program, VB 5 reports: "Runtime Error 3061: too few
parameters expected: 10". Note: I have already checked, that all fields
which are not allowed to be null in the table are filled with values.
e.g. leist.pnr

What is wrong with the number of parameters ???????????
!!!!!!!!!!!!!!!!!!Please help me !!!!!!!!!!!!!
How can I get ride off this error message so that my program would like
to work
Its is really urgent !

Thanks
Nina.

[ Attached Message ]

From:
To:
Date: Wed, 2 Dec 1998 14:40:58 -0500
Local: Wed, Dec 2 1998 2:40 pm
Subject: Saving the state of you program
I have an application which uses many DataCombo controls
with the list items linked to a database.

HOW can I allow the user to select items and then next
time the app is opened all controls come up as they were
before the app was closed.

Catch,,,,  I need to get to the row of the database table
which the user selected in the DataCombos so I can
read other initializing values..

Please respond...

Thanks,

Cliff Jones



Sat, 26 May 2001 03:00:00 GMT  
 ! HELP ! Inserting into Table -> Error: 3061

Nina

This is one of those classical problems, as far as VB in concerned your INSERT statement does not contain variables but values.  You should change

+"VALUES (leist.pnr

to

& "VALUES (" & leist.pnr & ", " & etc

Also in Access you would use the Execute method of the database object, something like this

Dim db As Database
Dim strSQL as String

Set db = CurrentDb

strSQL = "INSERT etc

db.Execute  strSQL dbFailOnError

I presume in VB it all has to be done through WorkSpaces etc but am not totally sure.

The last thing is step through the code, stop the execution at the qd.Execute  line, go to the debug window and type

? SQL

the result should be your SQL statement with the variable names replaced by the vales of your type. If not, your SQL statement is wrong.

Adrian


    I am programming in VB 5 and using an Access- DB.
    I have terrribly problems with INSERTING into a table which already exists (Patstamm) in an ACCESS- DB.
    My Code looks like this:
    Type leist
        .name As String
        .gebdat As String
        .blutgr As String
        .werEin As Integer
        ......
        .refNr As Integer
    End Type

    .....
    qd= Set db.CreateQueryDef("")
    qd.SQL= "INSERT INTO patstamm (pnr,aufn,svnr,kisnr,eindat,klasse,refNr," _
            +"wannein,werein,bergeben) "
            +"VALUES (leist.pnr,leist.aufn,.........leist.bergeben)"
    qd.Execute

    So the numbers of paramters of the insert statement are exactly the same as in the values statement. The leist- Type got filled with values from other tables with SELECT statements & using Recordset- Objects,.... before this statements and some of them must be allowed to contain null- Values (empty strings).
    e.g. klasse . Pnr and werein is not allowed to be null.

    When I run my program, VB 5 reports: "Runtime Error 3061: too few parameters expected: 10". Note: I have already checked, that all fields which are not allowed to be null in the table are filled with values. e.g. leist.pnr

    What is wrong with the number of parameters ???????????
    !!!!!!!!!!!!!!!!!!Please help me !!!!!!!!!!!!!
    How can I get ride off this error message so that my program would like to work
    Its is really urgent !

    Thanks
    Nina.



Mon, 28 May 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. query error 3061

2. Too few parameters. Expected (Error 3061)

3. Runtime error 3061

4. A2K, W2K: error 3061 with OpenRecordset method

5. Runtime error 3061

6. error 3061 with querydef and openrecordset

7. Run time error (3061) Expected 2

8. qdf.Execute error 3061

9. Run Time Error 3061

10. Error code 3061

11. error 3061 sql

12. Error 3061 again!!!

 

 
Powered by phpBB® Forum Software