Queries :: Delete All After First Cancelled Record

Aug 20, 2015

I have a cancelled service that gives a -1 to an ISCANNED field for each EventDate after the date the services are cancelled. Now I am permitted to Delete all of the cancelled records except the Min() date that =-1.

I built a query to find the value for the First Event date that =-1. I then built a delete query to delete all records after the First Event date that =-1 but it had to Join the "Find the value of the First query" to get the table records to show the records that were going to be deleted.It cannot delete.

Is there a module or VB that can be used to make the delete query work without using the joined "Find the value of the First query"?Something that will say "delete all the records after the first cancelled record"

View Replies


ADVERTISEMENT

Trapping "The DoMenuItem Action Was Cancelled" On No To Delete Record

Jun 7, 2006

:confused: Anyone know how to trap/prevent the msg "The DoMenuItem action was cancelled" after answering no to deleting a record? I followed the instructions at the following thread but no luck:

http://www.access-programmers.co.uk/forums/showthread.php?t=53206&highlight=DoMenuItem+action+cancelled

Here's the code:

----------------------------------
Private Sub Delete_Click()
On Error GoTo Err_Delete_Click
DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70
Exit_Delete_Click:
Exit Sub
Err_Delete_Click:
MsgBox Err.Description
Resume Exit_Delete_Click
End Sub

-----------------------------------
Private Sub Form_Delete(Cancel As Integer)
DoCmd.SetWarnings False
If MsgBox("Are you sure you want to delete this record?", vbYesNo) = vbNo Then
Cancel = True
Else
MsgBox "Record deleted!"
End If
End Sub
-------------------------------------

Thanks in advance.

View 2 Replies View Related

Queries :: Delete Max Record From A Table

Jul 23, 2015

I have table1 that I append data to. The unique_ID is the rpt_date.

On form1 (that shows the table1 data) I want to delete the Max rpt_date from the table1.

I have tried to create a query involving MaxOfrpt_date linked to the table1 by the rpt_date and then create a delete query but it doesn't work !!

View 1 Replies View Related

Queries :: Can't Delete Record In Unmatched Query

Jan 12, 2014

Access 2010

I created 3 find unmatched queries from the query wizard. The first one works great. I can delete a record in the query and it deletes the record in the main table.

The second one allows me to delete a record and gives me the pop up box that says " you are about to delete 1 record". I click yes, but when I check the table or reopen the query the same record reappears.

The third query does not even give me the option to delete.

I can create a regular select query and delete the records form 2nd and 3rd but not from the queries made from the unmatched wizard.

I am using the same fields in all 3 queries.

I do not have enforce referential integrity or the other 2 options checked in the relationship properties. (not sure if this makes a difference.)

I even tried to redo the unmatched queries but I get the same result for all 3.

I want to be able to delete the records in the other 2 queries.

View 4 Replies View Related

How To Delete Record Using Delete Query

May 19, 2011

I have two simple tables. I want to delete the records from Table1 that are on Table2. I've created a select query that gives me what I want but when I change to a delete query, I get this message: "Unable to delete from specified tables"

I think my problem has something to do with security but I can't figure out what to change.

View 13 Replies View Related

Modules & VBA :: Delete Of A Record From A List Of Records In A Subform Deletes Wrong Record

Jun 28, 2013

When we browse through records in a subform we store the records in the database.When we want to delete a records for example the third record from the five records always the first records will be deleted. How can we delete the records where the cursor is at? When we are at the third record and press the delete button the third record from the list in the subform should be deleted.

Code:

Option Compare Database
Dim FocusBln As Boolean
Private Sub Identificeer()
Me.[Datum Aangemaakt].Visible = True
Me.[Datum Aangemaakt].SetFocus
If Me.[Datum Aangemaakt].Text = "" Then

[code]...

View 11 Replies View Related

Cancelled Previous....

Aug 15, 2005

Hi there, I quickly made a database, and for some reason, can't get past this 'cancelled' error, to get it to occur, open the Companies form, click orders and then it pops up.

By deleting all of the data in my tables, I can get to a state where I can once again enter data, but after closing the orders subform and opening it again, once again I have the dreaded error.

If anyone has any ideas of why this may be happening, feel free to share them :P

Thanks alot,
James Prince

Edit,

Here's my table structure:

CompanyID PK Autonumber - Relationship
Name
Address1
Address2
Town
PostalalCode
TelephoneNumber
FaxNumber

OrderID PK Autonumber - Relationship
CompanyID - Relationship
WeekNumber
Price
PriceWithVAT

MPL Autonumber
OrderID - Relationship
PartNumber
Size
PriceEach
PricePer100
Quantity

Basically I used the forms wizard to create a linked sub form, and when moving to a new order thats when it errors I think.

View 1 Replies View Related

You Have Cancelled The Previous Operation

Sep 17, 2007

Hey all... I have three searchable fields in my query ATM if i search the MO, and the job code by themselves they don't error out. But if i try searching the FName field. It says "You have canceled the previous operation? Can someone help me with this

View 1 Replies View Related

The OpenForm Action Was Cancelled

Aug 23, 2005

I am trying to open a form with a specified record using double clicked event (list box) but access is throwin "The OpenForm action was cancelled". My code is:

Private Sub lstSchool_DblClick(Cancel As Integer)
Dim test As String
Dim thisForm As String

thisForm = "frmRegister"
test = "ID = " & "'" & lstSchool & "'"

DoCmd.OpenForm thisForm, , , test

End Sub

ID is a AutoNumber field. I have used this code in my other dbz and it works fine ....

View 12 Replies View Related

Dealing With Cancelled Jobs

Jan 5, 2005

Setup
i have a form (frmCustomers) with a subform (sfrmJobs). As you might have guessed, it keeps track of customers and jobs. One customer may have many jobs. within sfrmJobs are about 300 or so controls for about 300 or so fields (mostly yes/no boxes) and at the moment contains two subforms of its own. customers have an autonumber CustomerID and jobs have a user-entered numeric JobID.

Goal
it has been brought to my attention that some jobs may just not work out and must be deemed as "cancelled." however, my client wishes to retain these records rather than delete them. in order to maintain the integrity of the reports, i would like to remove these records from the non-cancelled customer database and place them elsewhere, but still retain the ability to review them if need be (but NOT to modify them).

Problem
the job can be cancelled at any point down the line, meaning that a job could have nearly no info or nearly all the info, and everything in between. each job record has a ton of fields. i don't know how to cut and paste an entire record (except for doing it field by field, which could take forever in this instance) into a new table. in this case, it would be several records, since i have a list of materials pertinent to each job as well as a list of services necessary for each job - all of which would have to be removed and placed elsewhere.

Cry for Help
what is the best way to go about this? some ideas i had were creating a parallel table for each table used in recording all of the job information and just manually (well, via VBA and recordsets) copying, pasting, then deleting. another is creating a checkbox that when clicked disables every control for the cancelled job (but oy vey that's a lot of controls to code the disabling for) and then have it reflected in my reports that these are only from the NON-cancelled jobs. does anyone else have an idea?

help?

thanks in advance
-Jason

View 2 Replies View Related

Error Handling When Report Cancelled

Oct 12, 2007

Just a quick one.

I'm not usre how to handle the error when cancelling a report. so when I hit a control to bring up a report and say I cancel it before I put in any parameters for example I get the dialog box " runtime error" "OpenReport action was cancelled" etc.

Could anyone help me on how to handle this with VBA so that it's at least a more user friendly dialog box?

thanks

View 3 Replies View Related

Workgroup Security Cancelled If Mdw File Is Deleted

Mar 14, 2007

Hello people of access world forums. I've decided to design a simple access db with 2003 version but with 2000 compatibility and everything appear to work ok.

After designing and testing the db, I have set the Jet user-level security options as described in some documentation and set the startup options too for a "clean type" start. Everything is ok: I have created the workgroup in a new .mdw file, joined the workgroup, set the users, set the groups, protect the forms I wanted to. If I try to open the db, it asks for user and password and the db works as espected about security.

But if I delete, move or change the .mdw filename, the db turns accesible without the implemented security. Only the startup option works but no user is prompted and the protected items turns unprotected.

I would like to know how can I associate the .mdw to the .mdb so I can't access the .mdb if the .mdw file is not present (i.e. copying the .mdb to another computer or something).

Thanks in advanced.

Kish

View 8 Replies View Related

Query In Subform - You Cancelled The Previous Operation

Jun 18, 2007

I have subform where access lists orderitems(the main form contains the order info). The subform uses a query to lookup items thats in the orderlist. Everything works fine execpt when I change something in a dropdowncombo list in the orderlist sheet(like in sample northwind db) the I get "You cancelled the previous operation". The post IS changed and everything seems to work nice but why do I get this error?

The combo uses "SELECT DISTINCT Items.IDItem, Items.Item FROM Items;" as rowsource and also "ListedItems.IDItem" as controlsource.

View 1 Replies View Related

Modules & VBA :: Output To PDF - On Click Action Cancelled

Jul 10, 2015

I have a button on-click action of:

Code:
DoCmd.OutputTo acOutputReport, "Bladereport", "PDFFormat(*.pdf)", , True, "", , acExportQualityPrint

It works perfectly with the box appearing to choose the directory and file name, having done this it then outputs perfectly.

However if you choose cancel at the file and directory selector box it crashes:

Run-time error '2501':
The OutputTo action was cancelled.

View 1 Replies View Related

Run-Time Error '2001':You Cancelled The Previous Operation.

Jul 27, 2005

I don't know why this error message appear.
this message appear when I a lookup function is run.
The code statement that genrate this error for me is:

CName = DLookup("Name", "VisCardHolders", "Indx=" & CIndx)

Dim CIndx as long
CIndx=50025

The VisCardholders is a recordset consists of two fields:
CIndx
Name

One of the exist records in the [VisCardholders] is
CIndx=50025
Name: James Southern


.I tried to find the reason of this error but unfortuantelly, I found nothing.
Please tell me.

View 7 Replies View Related

Runtime Error 2001- You Cancelled The Previous Operation

May 28, 2006

The code below is from a form named frmWorkorderComplete I use to append the tblWorkordersComplete table with data from the fields in the table tblWorkOrders. I'm trying to prevent duplicate entries in the tblWorkOrdersComplete table. To do this, I create a unique identifier for each record to be appended by combining the "ordered", "company", and "salescategory" into a string which is inserted into the "wonmbr" primary key field of the tblWorkorderComplete.

The following code is used in the subroutine to check if a particular wonmbr has already been appended. However, I keep receiveing the error: "Runtime Error 2001- You cancelled the previous operation" EVERYTHING else in this sub routine works fine when I remove the offending code:

If DCount("[wonmbr]", "tblWorkorderComplete", "[wonmbr] = str_wonmbr") > 0 Then
MsgBox "Workorder Already Appended!"
Exit Sub
Else


///////////////////////////
Private Sub Archive_Click()

' declare variables
Dim Variable1 As String
Dim Variable2 As String
Dim Variable3 As Date
Dim Variable4 As Date
Dim Variable5 As Date
Dim Variable6 As Date
Dim Variable7 As Date
Dim str_wonmbr As String
Dim strI As String
Dim strS As String
Dim strSQL As String

Variable1 = [company]
Variable2 = [salecategory]
Variable3 = [ordered]
Variable4 = [filled]
Variable5 = [billed]
Variable6 = [shipped]
Variable7 = [received]

' Create the unique identifier
str_wonmbr = Format([ordered], "yyyy-mm-dd") & "-" & [company] & "-" & [salescategory]

' HERE IS THE OFFENDING CODE
If DCount("[wonmbr]", "tblWorkorderComplete", "[wonmbr] = str_wonmbr") > 0 Then
MsgBox "Workorder Already Archived!"
Exit Sub
Else

' build SQL string
strI = "INSERT INTO tblWorkordersComplete (wonmbr, company, salescategory, ordered ) "
strS = "SELECT '" & str_wonmbr & "', '" & Variable1 & "', #" & Variable3 & "#, #" & Variable4 & "#, #" & Variable5 & "#, #" & Variable6 & "#, #" & Variable7 & "#;"
strSQL = strI & strS

' run SQL code and append data
DoCmd.RunSQL strSQL

End If
End Sub

View 1 Replies View Related

Forms :: Access 2010 - OpenForm Was Cancelled Error

Aug 5, 2013

I'm working with an old database and I am getting this error. I have have access 2010. I starting to receive this error after I unlinked one of the tables.

Private Sub Command9_Click()
On Error GoTo Err_Command9_Click

Dim stDocName As String
Dim stLinkCriteria As String

[Code] ....

View 3 Replies View Related

Forms :: Unable To Select Control After Event Cancelled

Apr 14, 2014

I have validation on a checkbox on a sub form and after the validation fails and the cancel = true is executed in the before update event, I am unable to select the checkbox on the form. Access will not allow the selection. my subform is called frmContactType so hopefully I am referencing it correctly:

Me.frmContactType.Form.chkAssociate

View 4 Replies View Related

Delete Record

Dec 4, 2006

I have a library database that I want to delete a record in my tblStatus when the book is returned. I have found the deleteobject function but it appears that that will delete like a table or query or report or something like that. I have no need to keep track of how many times a certain book has been checked out or that John Doe has checked out books X, Y and Z. As a mater of fact that is exactly what I don't want so I just want to delete the record that says Book ZZZ was checked out by John Doe. When the book is returned I just want it available for some one else.

Thanks in advance,

Rick

View 1 Replies View Related

Delete Record

Oct 1, 2007

Hello. I have form. and i need to delete record. Id is a unique key. When i have invisible textbox with source of this key, it's very easy to delete record from database. But is it possible to delete record with query without using textbox?

View 2 Replies View Related

Delete Record

May 31, 2005

Hi all, facing a little problem with my forms. Access gives me headaches everyday. Haha.

In a continuous form, I have a delete button with the following code

Private Sub cmdDelete_Click()
On Error GoTo Err_cmdDelete_Click

DoCmd.SetWarnings False
If MsgBox("Confirm deletion of the record?", vbQuestion + vbYesNo + vbDefaultButton2, "Delete?") = vbYes Then
DoCmd.RunCommand acCmdSelectRecord
DoCmd.RunCommand acCmdDeleteRecord
End If
Exit_cmdDelete_Click:
DoCmd.SetWarnings True
Exit Sub
Err_cmdDelete_Click:
MsgBox Err.Description
Resume Exit_cmdDelete_Click
End Sub

However, after the record is deleted, the focus is immediately set to the next field which creates a new record of null data. And since the fields are all required, I am forced to enter data into the new record, if not a pop up will inform to user to enter data.

I do not wish for this new record to be created everytime I delete a row. How do I go about it?

I'm learning more each day! Thanks in advance..

View 9 Replies View Related

Delete A Record

Feb 13, 2006

I have a problem with 1 of my form (FrmEditDrawing) that I use to edit a specific record from 1 of my table (TblDrawing). The user will see the Data for each drawing on a form that I called (FrmViewDrawing) and will be able to edit the data for each drawing by clicking a button that will open the form "FrmEditDrawing" on the specific record. In that case I can't edit and change the data for any fields but if I open the form on its own, I can edit and change the data ?
I guess it has something to do with the fact that I open twice the same recordsets which locks the table, I am not sure. What would be the different option to solve this problem?

View 7 Replies View Related

Do You Want To Delete This Record - Pop Up Box

Dec 4, 2006

When you want to delete a record out of MS Access, you get the default pop-up message confirming you want to delete the record [YES] [NO].

I have a few users who are not paying attention and hitting a combination of keys (I am guessing Alt + D) and getting this message. They then do not look, and confirm the deletion of the record.

I am thinking of two ways around this.

1) Change the default to [NO] when this pop-up dialog opens up (the default is [YES]).

2) Disable this pop-up box, and then create my own to confirm the deletion.

Are either of these possible, or has anyone ever had to work around this issue? I have never had an issue with this, and was not sure how to attack it.

Let me know.

Thank you,

T.J.

View 7 Replies View Related

Delete Record

Nov 18, 2004

i have an order form somewhat like the northwind database one. I called mine A5_frmOrders. i have a subform called A6_sfrmOrders, which is in datasheet view. I need to add a "Delete Record" button into the subform, but when i put it in the subform footer, it doesnt appear.

Like any orders subform, i have "Item", "Product", "Quantity", "Unit Price" and "Subtotal" with their corresponding labels in the Detail Section. I tried changnig the subform to "Continuous Form" and doing this :
header : Labels for "Item", "Product", "Quantity", "Unit Price" and "Subtotal"
detail : "Item", "Product", "Quantity", "Unit Price" and "Subtotal" for user to fill in
footer : Delete Record button

but even when i change to Continuous Form, it doesnt allow me to separate "Item" from its label and put one in the header and one in the detail...

how do i add in the delete record button? Is it true i cannot use datasheet view if i want a delete button?
Thanks

View 1 Replies View Related

Trying To Delete A Record With Code

Dec 11, 2005

Why does this code not delete the current record?

DoCmd.RunSQL "DELETE * FROM [Tble-Readings]WHERE
[Tble-Readings].[ID]= " & Me![ID] & ";"

I have this code on the a Close Button and if the record is incomplete I want it to be deleted from the table. The ID field is an autonumber so it is the 1st field to get a value if a user starts entering data. I get a msg box saying 0 fileds will be deleted why? the id's do match but it does not delete??

jon

View 5 Replies View Related

Delete A Record From Table

May 9, 2005

Hi,

Is it possible to delete a record from a table whilst viewing that table through a form. The awkward part though is because I have another table linked to it.

Basically the main table is Orders and the other table is Items (these items make up an order). So when I go to simply click on delete an error message appears saying that I cannot delete the record but there are records attached to it in another table. This is fair enough but is there a smooth way off deleting off the items?

Many thanks,

Paul.

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved