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

Need help in Parameters problem in Execute methos.

Hi, i have problem with the Execute statement at db.Execute (LDelete). The debugger told mi itz too few parameters Expected 1. Can any1 help mi.. thx in advance...



Private Sub Command4_Click()

Dim Month1 As String

Me.List2 = Me.List2.ItemData(List2.ListIndex)

Dim db As Database
Dim LDelete As String

Set db = CurrentDb()
LDelete = "DELETE FROM Table2 Where TEEST = Me.List2"
db.Execute (LDelete)
Set Lrs = Nothing
Set db = Nothing

MsgBox "Deleted !"


End Sub
Sep 9 '07 #1
1 1098
MMcCarthy
14,534 Expert Mod 8TB
Your statement in LDelete is wrong. Have a look at the following ...

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command4_Click()
  2. Dim Month1 As String
  3.      Dim db As Database
  4.     Dim LDelete As String
  5.  
  6.     Me.List2 = Me.List2.ItemData(List2.ListIndex)
  7.  
  8.     Set db = CurrentDb()
  9.     ' if TEEST is a string (Text) then change below to ...TEEST ='" & Me.List2 & "'"
  10.     LDelete = "DELETE FROM Table2 Where TEEST =" & Me.List2
  11.     db.Execute (LDelete)
  12.     Set Lrs = Nothing
  13.     Set db = Nothing
  14.  
  15.     MsgBox "Deleted !"
  16.  
  17. End Sub
  18.  
Sep 9 '07 #2

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

Similar topics

7
by: Zlatko Matiæ | last post by:
Let's assume that we have a database on some SQL server (let it be MS SQL Server) and that we want to execute some parameterized query as a pass.through query. How can we pass parameters to the...
2
by: Mark | last post by:
I created a test to check the execution time difference between executing a SQL Server stored procedured using explicit parameters versus not. In one case I created new SqlParameters in the code,...
2
by: Ryan Taylor | last post by:
Hello. I have an ASP.NET web application in which one page needs to execute another page and retrieve it's results. The page to be called needs a couple parameters passed in the URL. However,...
1
by: msnews.microsoft.com | last post by:
Hi Every One, I put a question befor about auto email alters, I got the answer that build a window service that auto email to the users. But How Service Execute. Means Window Service has methos...
7
by: keyser soze | last post by:
hi i have a stored proc, pointed by a synonym i wish to execute it vía: cmd.commandType= adStoredProc cmd.commandText= "s_MyStoredProc" cmd.parameters.refresh ---to get the collection the...
4
by: HeislerKurt | last post by:
I'm getting the infamous error, "Too few parameters. Expected 2", when executing an update SQL statement in VBA. I assume it's a SQL syntax issue, but I can't find the problem, and I used a VBA...
4
by: gmazza | last post by:
Hi there, I am trying to insert 4 fields into a table grabbing the 4 fields from a form, here is my code: Private Sub LastPaymentAmount_AfterUpdate() Dim CurrentProject As DAO.Database Set...
0
by: pso19 | last post by:
Hi, I am trying to access all the properties, methods of an assembly using reflection. But what i want to do is invoke a method which contains custom parametrs like enumeration defined in a...
2
bmallett
by: bmallett | last post by:
I am getting the following error: Error Type: ADODB.Command (0x800A0BB9) Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another....
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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: 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:
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,...

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.