473,782 Members | 2,487 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete issue

12 New Member
hello all,

Just a quick query

I currently have an hires form where clients place orders,
When an item is selected this would drop the item within a listbox and save within a itemhireline table. If clear is selected half way through an order i want the items within the listbox to be deleted from the tblitemhireline so when the next order is placed the listbox should be empty. It sounds pretty simple but i cannot get it to delete all the items that are linked to this itemhireno.

This is what i have been using - it only deletes one item every time the form is cleared

Set rstclear = database.OpenRe cordset("Select * from itemhireline Where itemhirno=" & Forms!frmitemhi reform!txtitemh ireno)
rstclear.Delete
Feb 27 '08 #1
2 1504
Megalog
378 Recognized Expert Contributor
Set rstclear = database.OpenRe cordset("Select * from itemhireline
Where itemhirno=" & Forms!frmitemhi reform!txtitemh ireno)
rstclear.Delete
Try something like this... There's probably a better way to handle the looping than using a goto.. <shrug> Back up your data first!

Expand|Select|Wrap|Line Numbers
  1. Dim rstclear as DAO.Recordset
  2. Dim itm as Variant
  3.  
  4. Set rstclear = CurrentDb.OpenRecordset("itemhireline", dbOpenDynaset)
  5. Repeat:
  6. rst.FindFirst "itemhirno = " & [Forms]![frmitemhireform].[txtitemhireno]
  7. if rst.nomatch = False Then
  8.      rstclear.Delete
  9.      goto Repeat
  10. end if
  11. Set rstclear = nothing
Feb 27 '08 #2
NeoPa
32,577 Recognized Expert Moderator MVP
Expand|Select|Wrap|Line Numbers
  1. Do [criteria]
  2. ...
  3. Loop [criteria]
Expand|Select|Wrap|Line Numbers
  1. While [criteria]
  2. ...
  3. Wend
Expand|Select|Wrap|Line Numbers
  1. For Var = X To Y [Step Z]
  2. ...
  3. Next Var
Feb 28 '08 #3

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

Similar topics

4
5888
by: Dmitri Zhukov | last post by:
This topic was widely discussed before but somehow I still have no idea how to fix the problem. I've a C++ class which resides inside DLL and has some STL members inside. The EXE uses STL vector of my classes and get run time crash on the destructors in the RTLValidateHeap function. The knowledge base Q122675 article explains the situation. However the solution offered by Microsoft on declaring constructor and destructor inline does not...
2
11802
by: Bob Ganger | last post by:
Hello, I am working on a project using SQL Server 2000 with a database containing about 10 related tables with a lot of columns containing text. The total current size of the database is about 2 Gig. When I delete data from the database, it takes a lot of system resources and monopolizes the database so that all other query requests are slow as mud! Ideally, I would like to be able to issue delete commands to the database on a...
8
4066
by: Steve | last post by:
I have several pairs of synchronized subforms in an application. I have a Delete button for each pair that uses the following code or similar to delete a record in the second subform: DoCmd.SetWarnings False DoCmd.RunCommand acCmdDeleteRecord DoCmd.SetWarnings True End If ExitHere: Me!SubName.SetFocus
6
3858
by: polocar | last post by:
Hi, I'm writing a program in Visual C# 2005 Professional Edition. This program connects to a SQL Server 2005 database called "Generations" (in which there is only one table, called "Generations"), and it allows the user to add, edit and delete the various records of the table. "Generations" table has the following fields: "IDPerson", NamePerson", "AgePerson" and "IDParent". A record contains the information about a person (his name, his...
17
2073
by: (PeteCresswell) | last post by:
I've got apps where you *really* wouldn't want to delete certain items by accident, but the users just have to have a "Delete" button. My current strategies: Plan A: ------------------------------------------------------------------------ 1) Make the cmd button black and do not give it an accelerator key. 2) Issue two levels of confirmation (Do you want to delete... Do you REALLY want
6
4159
by: jefftyzzer | last post by:
Friends: Let's say I'd like perform a delete, but before I delete, I'd like to export the target rows. I could use an export whose SELECT clause references the OLD TABLE of a DELETE, but the issue is I'm deleting the table in chunks, like so: WHILE (V_NO_DATA = 0) DO DELETE FROM
24
7564
by: biganthony via AccessMonster.com | last post by:
Hi, I have the following code to select a folder and then delete it. I keep getting a Path/File error on the line that deletes the actual folder. The line before that line deletes the files in the folder but I get the error message when the procedure attempts to delete the folder selected in the BrowseforFolderbyPath function. How can I get it to delete the folder that the user has selected in the Browse for Folder dialog?
12
2571
by: Premal | last post by:
Hi, I tried to make delete operator private for my class. Strangely it is giving me error if I compile that code in VC++.NET. But it compiles successfully on VC++6.o. Can anybody give me inputs about it. I wanted that on my class delete should not work. Object pointer should be deleted using my function only which is taking care of reference count for particular class. Thanx in advance for your inputs.
4
2586
by: Craggy | last post by:
Hi, I am trying to pop up a yes/no message box so that a user can delete a record in a continuous form. The default delete message is a bit sloppy because it seems to move the continuous form to the position of the record u want to delete. If you then choose to not to delete the record it looks to a user as if it has deleted every record before the one you chose not to delete. To get around this I made a yes/no msgbox pop up and only after...
19
10763
by: Daniel Pitts | last post by:
I have std::vector<Base *bases; I'd like to do something like: std::for_each(bases.begin(), bases.end(), operator delete); Is it possible without writing an adapter? Is there a better way? Is there an existing adapter? Thanks, Daniel.
0
9639
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10311
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10146
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10080
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9942
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8967
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
4043
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3639
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2874
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.