473,410 Members | 1,952 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,410 software developers and data experts.

Error 3061 has occurred at run time. Few parameters. Expected 1

10 Byte
Good morning I'm calling again about a problem with SELECT, please.

Expand|Select|Wrap|Line Numbers
  1. Set rs1 = DB.OpenRecordset("Select   [RADICADO], " _
  2.                   & "[Cedula Cliente] FROM BaseDatosMatriz " _
  3.                   & "where [CEDULA CLIENTE] = [Form]![CEDULA]")
HAVE LOOKED FOR IT AND ALL THE FIELDS ARE WELL SITUATED
BUT I DON'T KNOW. PLEASE IF YOU GIVE ME A HELP. THANK YOU
VERY MUCH.
Expand|Select|Wrap|Line Numbers
  1.   [RADICADO]           SHORT TEXT   FIELD SIZE  23
  2.   [CEDULA CLIENTE ]    SHORT TEXT   FIELD SIZE  12
  3.   CEDULA               SHORT TEXT   FIELD SIZE  12

Expand|Select|Wrap|Line Numbers
  1. Dim DB As Database
  2. Dim rs As Recordset
  3. Dim rs1 As Recordset
  4. Set DB = CurrentDb
  5. Set rs = DB.OpenRecordset("BaseDatosMatriz")
  6.  
  7. Set rs1 = DB.OpenRecordset("Select * ,[RADICADO], " _
  8. & "[Cedula Cliente] FROM BaseDatosMatriz " _
  9. & "where [CEDULA CLIENTE] = CEDULA")
Oct 20 '20 #1
4 2564
isladogs
456 Expert Mod 256MB
... "where [CEDULA CLIENTE] = '" & CEDULA & "'")
Oct 21 '20 #2
twinnyfo
3,653 Expert Mod 2GB
Eddy,

A good practice to get into is to always declare a string variable for your SQL statement. This 1) allows you to evaluate the string for errors and 2) sometimes access doesn't like to include static/form references when you try to set a recordset that way. I would recommend something like this (including IslaDogs' correction):

Expand|Select|Wrap|Line Numbers
  1. Dim DB As Database
  2. Dim rs As Recordset
  3. Dim rs1 As Recordset
  4. dim strSQL As String
  5.  
  6. strSQL = _
  7.     "SELECT " & _
  8.         "[RADICADO], " & _
  9.         "[Cedula Cliente] " & _
  10.     "FROM " & _
  11.         "BaseDatosMatriz " & _
  12.     "WHERE " & _
  13.         "[CEDULA CLIENTE] = '" & [Form]![CEDULA] & ";"
  14.  
  15. Set DB = CurrentDb
  16. Set rs = DB.OpenRecordset("BaseDatosMatriz")
  17. Set rs1 = DB.OpenRecordset(strSQL)
Thus, at any point in your code, you could insert: Debug.Print strSQL and that value will be sent to your immediate window. You can then evaluate or copy and paste into your query editor to see how it works.

Hope that hepps!
Oct 21 '20 #3
EddyBohorquez
10 Byte
sla thank you very much, for that help, God bless you.
Also to Twinnyfo for advice on structuring the codes in an easy way to get the bugs.

thank you very much.
Eddy
Oct 21 '20 #4
isladogs
456 Expert Mod 256MB
On behalf of us both, you're welcome
Oct 21 '20 #5

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

Similar topics

6
by: Jonathan LaRosa | last post by:
I am trying to open a recordset and I am getting an error and I can't figure out why. See code below. sqlString2 does not work. sqlString does. Clearly the problem is with the nested SELECT...
2
by: Steve Richfield | last post by:
There have been LOTS of postings about error 3061, but mine seems to be an even simpler case than the others. I have a simple **FUNCTIONING** query called qryEdits. Copying the SQL from the query,...
4
by: Richard Hollenbeck | last post by:
I thought I was very specific in this SQL request. There is a form open with a selected record (and a corresponding "lngRecipeID" on that form. The table also has a field called "lngRecipeID". ...
3
by: phill86 | last post by:
Hi, I am trying to run the following query in a recordset and i get the following error message Runtime error 3061 - Too few parameters. Expected 1 i am using the following code
3
by: tasawer | last post by:
Hi, I need to add a new record to table "ACC_Vehicle", with three pieces of information. When I activate the code, I get the error "Error 3061, Too few parameters Expected 1" ACCVehicleID is...
6
by: dowlingm815 | last post by:
I am receiving error code too few parameters. Expected 1. I can't seem to find the issue. The error code occurs when on this line of code: Set rstTemp =...
7
by: bunchaCoconuts | last post by:
I'm trying to figure out why I'm getting this error. I'm relatively inexperienced. The nature of the following code is that a slightly different query is run whether or not the "ImportantDatesOnly"...
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...
5
by: mary2210 | last post by:
Hi, Iam getting this error when I try to update a query for a Form of MS Access. How can I resolve this. Please help. CurrentDb.Execute "UPDATE IQStudents SET Tnumber= '& Me.txtTnumber &',...
7
Seth Schrock
by: Seth Schrock | last post by:
This one really has me puzzled. Normally I know how to deal with this type of error, but this time it is defying all my troubleshooting knowledge. I have a query def (qryCustomerCreditScore). In...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

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.