By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,828 Members | 2,241 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,828 IT Pros & Developers. It's quick & easy.

Need help in Parameters problem in Execute methos.

P: 4
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
Share this Question
Share on Google+
1 Reply


MMcCarthy
Expert Mod 10K+
P: 14,534
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

Post your reply

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