473,387 Members | 1,650 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.

delete code problem.help needed urgently

my code:
rs!empnamee = Trim(Text1.Text)
On Error Resume Next

con.Execute "delete from paymentemployacc where empnamee='" & Trim(Text1.Text) & "'"
MsgBox "Employ deleted"

Call sClear(Me)

it deletes the records mentioned in text1
but, it allways messages employ deleted but there is no such records
so, please help me with good working code
1>which should give message when record not found
2>which should give message when record is deleted
3>which should delete the records written in textbox including duplicate names
Aug 21 '07 #1
3 1272
MikeTheBike
639 Expert 512MB
my code:
rs!empnamee = Trim(Text1.Text)
On Error Resume Next

con.Execute "delete from paymentemployacc where empnamee='" & Trim(Text1.Text) & "'"
MsgBox "Employ deleted"

Call sClear(Me)

it deletes the records mentioned in text1
but, it allways messages employ deleted but there is no such records
so, please help me with good working code
1>which should give message when record not found
2>which should give message when record is deleted
3>which should delete the records written in textbox including duplicate names
Hi

Perhaps you could use the RecordsAffected property of the Execute method!?

MTB
Aug 21 '07 #2
Killer42
8,435 Expert 8TB
Just a more-or-less unrelated comment. It looks as though this code will fail if you hit a name containing an apostrophe. For example, "O'Reilly". You might want to have a look at the index of tips and tricks in the Access forum. I believe it contains an entry which talks about string delimiters, including this sort of pitfall.
Aug 22 '07 #3
fplesco
82
my code:
rs!empnamee = Trim(Text1.Text)
On Error Resume Next

con.Execute "delete from paymentemployacc where empnamee='" & Trim(Text1.Text) & "'"
MsgBox "Employ deleted"

Call sClear(Me)

it deletes the records mentioned in text1
but, it allways messages employ deleted but there is no such records
so, please help me with good working code
1>which should give message when record not found
2>which should give message when record is deleted
3>which should delete the records written in textbox including duplicate names
Hi -

What are you trying to do in this code?
Expand|Select|Wrap|Line Numbers
  1. rs!empnamee = Trim(Text1.Text)
  2.  
I guess, this should be
Expand|Select|Wrap|Line Numbers
  1. Text1.Text = Trim(rs!empnamee)
  2.  
As per your problem, all you have to do is to search first the record. Then, if you find it, issue a delete command.
Expand|Select|Wrap|Line Numbers
  1. con.Execute "Select * from paymentemployacc where empnamee='" & Trim(Text1.Text) & "'"
  2. If not <Recordset variable>.EOF then
  3.         RecordFound = True
  4. Else
  5.        RecordFound = False
  6. End if
  7. If RecordFound = True then 
  8.     con.Execute "delete from paymentemployacc where empnamee='" & Trim   (Text1.Text) & "'"
  9.     MsgBox "Employ deleted"
  10. Else
  11.     Msgbox "No record found!"
  12. End if
  13.  
Aug 23 '07 #4

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

Similar topics

0
by: Kamliesh Nadar | last post by:
Hi I am developing a software using VB.NET I am facing following problems - 1. Though I have placed the NotifyIcon control on the window service application, after starting the service I am...
13
by: Axel Panning | last post by:
Hallo, ich hab bei einem Programm bei mir festgestellt, daß das "deleten" von Feldern erheblich länger dauert, als das Anlegen von Feldern. p. Bei einem Programm von mir werden oft große...
4
by: xunitinmullik | last post by:
Hello ppl: I am facing a problem that I ahve never experienced before with the secured database. I created an MS Access 2000 application (.mdb) using MS Access 2002 and secured it using exactly...
3
by: gauravkg via DotNetMonster.com | last post by:
Hi i have a problem I have a product product_name=taj Mahal product_id=111 i and different users will be putting reviews title and review description. this is the following xml file i...
1
by: pathakrajeev | last post by:
Hi I needed help urgently. Suppose I have file name like test12wehow.asp test11234r5wesow.asp,upppwenow.asp. one thing is common in all the files are "we". I want to read the file as...
0
by: rajvbprogramer | last post by:
hello friends can u help me with this problem . i needed it urgently. i first used DAO then some told me to do ADO. now i m stuck. now i dont know what to do.. my problem is to compare two...
6
by: IanWright | last post by:
I've got a segmentation fault problem and am wondering if anyone can help me. I'll apologise now for the fact that I've about a week experience using C++, but I'll try my best to follow any replies...
0
by: perdoname | last post by:
Hello, I urgently need help, im trying to complete a class which will be able of multiple - clients but is not doing the required puprose. Can anyone be assistance of what is needed to add for...
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: 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?
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.