473,405 Members | 2,262 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,405 software developers and data experts.

error 3061 como solvento este error

10 Byte
al ejecutar

Expand|Select|Wrap|Line Numbers
  1. db.Execute "INSERT INTO BaseDatosMatriz" _
  2.     & "([CEDULA CLIENTE],[ID_JURIS],[ID_ESP],[TIPO DE PROCESO],[RADICADO]," _
  3.     & "[DEMANDATES],[DEMANDADOS],[CAUSANTE],[CURADOR],[FECHA_DE_REGISTRO]," _
  4.     & "[NUMERO CARPETA],[CAJA],[NOTAS],[APDE_DEMANDANTES],[APDE_DEMANDADOS],[FECHA_FIN])" _
  5.     & "values( Form![CEDULA CLIENTE],Form![ID_JURIS],Form![ID_ESP],Form![TIPO DE PROCESO],Form![RADICADO]," _
  6.     & "Form![DEMANDATES],Form![DEMANDADOS],Form![CAUSANTE],Form![CURADOR],Form![FECHA_DE_REGISTRO]," _
  7.     & "Form![NUMERO CARPETA],Form![CAJA],Form![NOTAS],Form![APDE_DEMANDANTES],Form[APDE_DEMANDADOS],Form![FECHA_FIN]);"
  8.  
  9. db.Close
Al llenar formulario me indica error 3061 en tiempo de ejecucion, se esperaba 16 parametros aun colocandole todos los parametros en cada campo. alguien me puede ayudar con eso

==============================================
English Translation:
when executing

{CODE}

When filling out the form it indicates error 3061 at runtime, 16 parameters were expected even placing all the parameters in each field. can someone help me with that
Sep 2 '20 #1

✓ answered by ADezii

@twinnyfo:
One day I keep you on your toes, the next day you keep me on my toes! (LOL)

P.S. - We also have to take into consideration that there may be 1 or more DATE/TIME Fields that will also have to be Delimited. As you stated, we need an English Version along with all Data Types for Fields involved in the SQL Statement. Take care and stay safe.

15 2136
twinnyfo
3,653 Expert Mod 2GB
Eddy,

First, Welcome to Bytes!

Second, we request posters to use English on our forum, so please do so, if possible. We always try to work through language challenges with you.

Third, fundamentally, there may not be be anything wrong with your Code, but MS Access has a tendency to not like using references to form controls directly from within its executable functions. What I mean by that is that it is often better (and in practice I always do this) to generate a finished string variable and then send that string to the function. You also need to be careful to use the proper punctuation and syntax here. This also allows you to evaluate your string before you use it and examine that string within the Query Builder of Access.

Fourth, it is unclear what "Form!" refers to. as it stands, Access has no idea what you are telling it to get. If this code is resident on a form, and the items in square brackets are controls on that Form, then the proper sytax would be simply "Me.". I am assuming this is the case, so I have modified that in your code.

As a final recommendation, as I do with all examples of this sort, I highly recommend that you name your controls something other than merely the name of the field to which they apply. So, a text box that holds the data for [CEDULA CLIENTE] has a name of txtCedulaCliente. This allows Access to differentiate between the text box and the underlying field--which is sometimes helpful, not to mention the ambiguities that are raised when you don't employ this practice.

Also,it looks like you may have missed a few required spaces. See below:

Expand|Select|Wrap|Line Numbers
  1. Option Explicit
  2. Option Compare Database
  3.  
  4. Private Sub YourSubName()
  5.     Dim strSQL As String
  6.     Dim db As DAO.Database
  7.  
  8.     strSQL = _
  9.         "INSERT INTO BaseDatosMatriz (" & _
  10.             "[CEDULA CLIENTE], " & _
  11.             "[ID_JURIS], " & _
  12.             "[ID_ESP], " & _
  13.             "[TIPO DE PROCESO], " & _
  14.             "[RADICADO], " & _
  15.             "[DEMANDATES], " & _
  16.             "[DEMANDADOS], " & _
  17.             "[CAUSANTE], " & _
  18.             "[CURADOR], " & _
  19.             "[FECHA_DE_REGISTRO], " _
  20.             "[NUMERO CARPETA], " & _
  21.             "[CAJA], " & _
  22.             "[NOTAS], " & _
  23.             "[APDE_DEMANDANTES], " & _
  24.             "[APDE_DEMANDADOS], " & _
  25.             "[FECHA_FIN]) "
  26.     strSQL = strSQL & _
  27.         "VALUES (" & _
  28.             Me.[CEDULA CLIENTE] & ", " & _
  29.             Me.[ID_JURIS] & ", " & _
  30.             Me.[ID_ESP] & ", " & _
  31.             Me.[TIPO DE PROCESO] & ", " & _
  32.             Me.[RADICADO] & ", " & _
  33.             Me.[DEMANDATES] & ", " & _
  34.             Me.[DEMANDADOS] & ", " & _
  35.             Me.[CAUSANTE] & ", " & _
  36.             Me.[CURADOR] & ", " & _
  37.             Me.[FECHA_DE_REGISTRO] & ", " & _
  38.             Me.[NUMERO CARPETA] & ", " & _
  39.             Me.[CAJA] & ", " & _
  40.             Me.[NOTAS] & ", " & _
  41.             Me.[APDE_DEMANDANTES] & ", " & _
  42.             Me.[APDE_DEMANDADOS] & ", " & _
  43.             Me.[FECHA_FIN] & ");"
  44.  
  45.     Set db = CurrentDB()
  46.     db.Execute
  47.     db.Close
  48.  
  49. End Sub
Hope this hepps!
Sep 3 '20 #2
ADezii
8,834 Expert 8TB
My guess would be that you are not Delimiting Text Fields:
Expand|Select|Wrap|Line Numbers
  1. Dim strSQL As String
  2. Dim strFName As String
  3. Dim strLName As String
  4. Dim lngZip As Long
  5. Dim db As DAO.Database
  6.  
  7. strFName = "A"
  8. strLName = "Dezii"
  9. lngZip = 9999
  10.  
  11. strSQL = "INSERT INTO Employees([First Name],[Last Name],[Zip]) VALUES('" & strFName & "','" & _
  12.                                  strLName & "'," & lngZip & ");"
  13. Set db = CurrentDb
  14.  
  15. db.Execute strSQL, dbFailOnError
  16.  
  17. db.Close
  18. Set db = Nothing
Sep 3 '20 #3
twinnyfo
3,653 Expert Mod 2GB
ADezii,

Thanks for the reminder that the syntax for numeric and string values will be different!

Always keeping me on my toes!
Sep 3 '20 #4
ADezii
8,834 Expert 8TB
@twinnyfo:
One day I keep you on your toes, the next day you keep me on my toes! (LOL)

P.S. - We also have to take into consideration that there may be 1 or more DATE/TIME Fields that will also have to be Delimited. As you stated, we need an English Version along with all Data Types for Fields involved in the SQL Statement. Take care and stay safe.
Sep 3 '20 #5
EddyBohorquez
10 Byte
buenas tardes,gracias por darme la oportunidad de solicitar el problema. ya coloque la forma que tu lo requieres. pero cuando al ejecutar nos indica que tiene error en INSERT INTO, en la instruccion "db.Execute strSQL", por favor si puedes dar una ayuda. Anexo las notas de auxiliar.

Dim strSQL As String
Dim db As DAO.Database
strSQL = _
"INSERT INTO BaseDatosMatriz (" & _
"[CEDULA CLIENTE]," & _
"[ID_JURIS]," & _
"[ID_ESP]," & _
"[TIPO DE PROCESO]," & _
"[RADICADO]," & _
"[DEMANDANTES]," & _
"[DEMANDADOS]," & _
"[CAUSANTE]," & _
"[CURADOR]," & _
"[FECHA_DE_REGISTRO]," & _
"[NUMERO CARPETA]," & _
"[CAJA]," & _
"[NOTAS]," & _
"[APDE_DEMANDANTES]," & _
"[APDE_DEMANDADOS]," & _
"[FECHA_FIN])"

strSQL = strSQL & _
"values( " & _
Me.CEDULA_CLIENTE & ", " & _
Me.ID_JURIS & ", " & _
Me.ID_ESP & ", " & _
Me.TIPO_DE_PROCESO & ", " & _
Me.RADICADO & ", " & _
Me.DEMANDANTES & ", " & _
Me.DEMANDADOS & ", " & _
Me.CAUSANTE & ", " & _
Me.CURADOR & ", " & _
Me.FECHA_DE_REGISTRO & ", " & _
Me.NUMERO_CARPETA & ", " & _
Me.CAJA & ", " & _
Me.NOTAS & ", " & _
Me.APDE_DEMANDANTES & ", " & _
Me.APDE_DEMANDADOS & ", " & _
Me.FECHA_FIN & ");"
Set db = CurrentDb()

db.Execute strSQL
db.Close

nota: todos los campos son de texto y dos Fechas dd/mm/aaaa

Muchas Gracias.
EDDY
Sep 4 '20 #6
ADezii
8,834 Expert 8TB
Necesitamos la traducción al inglés para poder ayudarlo, así como todos los tipos de datos en la tabla BaseDatosMatriz.
We need the English Translation in order to assist you, as well as all the Data Types in the BaseDatosMatriz Table.
Sep 4 '20 #7
EddyBohorquez
10 Byte
good afternoon, thanks for giving me the opportunity to request the problem. I already put the form that you require. but when when executing it tells us that it has an error in INSERT INTO
Abrir en Google Traductor
Com

Dim strSQL As String
Dim db As DAO.Database
strSQL = _
"INSERT INTO BaseDatosMatriz (" & _
"[CEDULA CLIENTE]," & _
"[ID_JURIS]," & _
"[ID_ESP]," & _
"[TIPO DE PROCESO], "& _
" [RADICADO], "& _
" [DEMANDANTES], "& _
" [DEMANDADOS], "


"[FECHA_DE_REGISTRO]," & _
"[NUMERO CARPETA]," & _
"[CAJA]," & _
"[NOTAS]," & _
"[APDE_DEMANDANTES]," & _
"[APDE_DEMANDADOS]," & _
" [FECHA_FIN]) "

strSQL = strSQL & _
" valores ("& _
Me.CEDULA_CLIENTE &", "& _
Me.ID_JURIS &", "& _
Me.ID_ESP &", "& _
Me.TIPO_DE_PROCESO &", " & _
Yo.RADICADO & "," & _
Yo.DEMANDANTES & ", "& _
Me.DEMANDADOS &", "& _
Me.CAUSANTE &", "& _
Me.CURADOR &", "& _
Yo.FECHA_DE_REGISTRO & "," & _
Yo.NUMERO_CARPETA & "," & _
Yo.CAJA & "," & _
Yo.NOTAS & "," & _
Yo.APDE_DEMANDANTES & "," & _
Yo.APDE_DEMANDADOS & " , "& _
Me.FECHA_FIN &"); "
Set db = CurrentDb ()

db.Execute strSQL
db.Close

note: all fields are text and two Dates mm / dd / yyyy

EDDY
Sep 4 '20 #8
ADezii
8,834 Expert 8TB
What two Fields are the Date Fields?
Sep 4 '20 #9
EddyBohorquez
10 Byte
good afternoon, thanks for giving me the opportunity to request the problem. I already put the form that you require. but when you can execute it tells us that it has an error in INSERT INTO, in the instruction "db.Execute strSQL", please give a help. Annex the auxiliary notes.

Dim strSQL As String
Dim db As DAO.Database
strSQL = _
"INSERT INTO BaseDatosMatriz (" & _
"[CEDULA CLIENTE]," & _
"[ID_JURIS]," & _
"[ID_ESP]," & _
"[TIPO DE PROCESO]," & _
"[RADICADO]," & _
"[DEMANDANTES]," & _
"[DEMANDADOS]," & _
"[CAUSANTE]," & _
"[CURADOR]," & _
"[FECHA_DE_REGISTRO]," & _
"[NUMERO CARPETA]," & _
"[CAJA]," & _
"[NOTAS]," & _
"[APDE_DEMANDANTES]," & _
"[APDE_DEMANDADOS]," & _
"[FECHA_FIN])"

strSQL = strSQL & _
"values( " & _
Me.CEDULA_CLIENTE & ", " & _
Me.ID_JURIS & ", " & _
Me.ID_ESP & ", " & _
Me.TIPO_DE_PROCESO & ", " & _
Me.RADICADO & ", " & _
Me.DEMANDANTES & ", " & _
Me.DEMANDADOS & ", " & _
Me.CAUSANTE & ", " & _
Me.CURADOR & ", " & _
Me.FECHA_DE_REGISTRO & ", " & _
Me.NUMERO_CARPETA & ", " & _
Me.CAJA & ", " & _
Me.NOTAS & ", " & _
Me.APDE_DEMANDANTES & ", " & _
Me.APDE_DEMANDADOS & ", " & _
Me.FECHA_FIN & ");"
Set db = CurrentDb()

db.Execute strSQL
db.Close
note: all fields are text and two dates mm / dd / yyyy

EDDY
Sep 4 '20 #10
EddyBohorquez
10 Byte
Estas son las dos fechas: Gracias
[fecha_de_registro]," & _
" [fecha_fi
Sep 4 '20 #11
EddyBohorquez
10 Byte
ESTAS SON LAS FECHAS, GRACIAS

ME.FECHA_DE_REGISTRO & "," & _
Me.FECHA_FIN &")
Sep 4 '20 #12
EddyBohorquez
10 Byte
[fecha_de_registro], "& _
" [fecha_fin])"
Sep 4 '20 #13
ADezii
8,834 Expert 8TB
Try the following adjustment ([FECHA_DE_REGISTRO] & [FECHA_FIN] are Dates):
Expand|Select|Wrap|Line Numbers
  1. '***** SOME CODE INTENTIONALLY OMITTED *****
  2. strSQL = strSQL & _
  3.          " VALUES('" & _
  4.          Me.CEDULA_CLIENTE & "', '" & _
  5.          Me.ID_JURIS & "', '" & _
  6.          Me.ID_ESP & "', '" & _
  7.          Me.TIPO_DE_PROCESO & "', '" & _
  8.          Me.RADICADO & "', '" & _
  9.          Me.DEMANDANTES & "', '" & _
  10.          Me.DEMANDADOS & "', '" & _
  11.          Me.CAUSANTE & "', '" & _
  12.          Me.CURADOR & "', #" & _
  13.          Me.FECHA_DE_REGISTRO & "#, '" & _
  14.          Me.NUMERO_CARPETA & "', '" & _
  15.          Me.CAJA & "', '" & _
  16.          Me.NOTAS & "', '" & _
  17.          Me.APDE_DEMANDANTES & "', '" & _
  18.          Me.APDE_DEMANDADOS & "', #" & _
  19.          Me.FECHA_FIN & "#);"
  20. '***** SOME CODE INTENTIONALLY OMITTED *****
Sep 4 '20 #14
EddyBohorquez
10 Byte
Thank you ADezii. That worked! Eureka !, Eureka !, Thank God and you. I have also been retired for 20 years, 3 months ago I have been learning Access, to make a legal system for my brother-in-law. Well thank you very much. God bless you.
Sep 5 '20 #15
ADezii
8,834 Expert 8TB
You are quite welcome and bless you also. Good Luck with your Project and stay safe.
Sep 5 '20 #16

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Steve | last post by:
I just spent waaaaaaaaaaaayy too much time trying to track down an error that was incorrectly reported just now, and I would like to see if someone can explain to me why it was reported that way. ...
3
by: Tu Quach | last post by:
I have an error with the following code Dim rs As DAO.Recordset Set dbs = CurrentDb strSQL = "SELECT * FROM table1 WHERE table1.Schedule_Item LIKE ""AA"" AND table1.Item1 = " & Form!Item1
2
by: Jon | last post by:
Hello all: I'm trying to modify an existing db for someone who wants to set appointments in a customer db. They want to prevent someone from double booking appts. I've developed a few lines...
13
by: lgbjr | last post by:
Hello All, I have some pictureboxes on a VB.NET form that are linked to an AccessDB. If the user wishes to open or edit an image, I need to save the image in the picturebox to a temp file, then...
2
by: mike_li | last post by:
On Window 2000 Professional Server DB2 UDB Level: DB2 code release "SQL07029" with level identifie "030A0105" and informational tokens "DB2 v7.1.0.98", "n040510" and "WR21337". In the...
1
by: sethuganesh | last post by:
HI, i have ported vc++ 6.0 code to visual studio 2005. During batch build in debug mode i din't get any error.But if i build the same in release mode i am getting the following error. ...
2
by: technocraze | last post by:
Hi guys, I have encountered this error when updating the values to the MS Acess table. Error : Update on linked table failed. ODBC sql server error Timeout expired. MS Acess is my front end and...
4
by: Ooi Lee Chin | last post by:
I set my IIS by using the Basic Authentication. It will display the authentication dialog box to let user re-enter username and password. After 3 time it will reporting an error to user. The error...
3
by: lingjun | last post by:
Hi, I am taking my first programing course in college... and I am completely lost on this assignment. I am not sure what is wrong with my current code. Any help will be appreciate it... thanks! ...
2
by: baruc308 | last post by:
I cant run this. please help! the error is run-time error 3061 too few parameters expected 1 in this line --------->> Set rs = db.OpenRecordset <---- below Public Function...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.