473,790 Members | 2,380 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Deleting Records in the Form View

11 New Member
This can be ignored... I did a bunch more searching and tried a few more things listed on different posts. I was able to get the delete query to work properly by adding a statement in the code (Me.Requery) to refresh the information on the form and the #deleted went away.

--------------------------------------------------------------------------------------------------------------


First of all, I want to say thanks for help on my previous posts. This site has been really helpful.

I have a database (DB1) that contains information about drawing markups with records dating back to 2005. In order to keep the size of the database manageable, I am archiving the older records to a separate database (DB2) while keeping a record in DB1 of the markup IDs and the drawing numbers of records that are in DB2. In the form that is used for data entry for the drawing markups, I added a button that runs a macro with the following steps:

1. Displays a message that you are archiving a record.
2. Opens an append query (aqry1) to copy the information in the record from DB1 to DB2.
3. Opens an append query (aqry2) to copy the markup ID and drawing number from the current record to a new table in DB1.
4. Closes the two append queries.

I've gotten the two queries to work properly, but I also want to be able to delete the current record from DB1. I've tried a couple of different ways to do this, but none have been truly successful yet. First I tried adding a step 5 to the macro that used the RunCode action and ran the following procedure:

Expand|Select|Wrap|Line Numbers
  1. Public Function deleteRecord()
  2. On Error GoTo Err_deleteRecord
    DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
    Exit_deleteRecord:
    Exit Function
    Err_deleteRecord:
    MsgBox Err.description
    Resume Exit_deleteRecord
    End Function
For whatever reason, when the macro runs, it never deletes the record. Because this didn't work, I also tried using a delete query. I added two steps to the macro to open the delete query and then close the delete query. While this works to delete the information in the record, it doesn't truly delete the record. The fields for the record all say #Deleted, but the record physcially remains attached to the database.

Is there a way to get the record to truly delete and be removed from DB1?

I've also tried using different delete record commands and none of them seem to work. On one or two of the other delete commands, I got a message saying that the delete record option wasn't available. Any advice on how to get this working would be really helpful.

Thanks,
Sarah
Jun 18 '07 #1
1 2588
nico5038
3,080 Recognized Expert Specialist
I try to prevent to use the DoCmd.DoMenuIte m command as it won't work when the menuitem(s) aren't available.

Instead I use the currentdb.execu te statement like:

Expand|Select|Wrap|Line Numbers
  1. currentdb.execute ("delete * from tblX")
  2. 'or for one row:
  3. currentdb.execute ("delete * from tblX where ID=" & Me!ID)
  4.  
Thus the table is managed directly and also no warningmessages will appear.
They can be activated when you want by adding the appropriate parameter to the command, but in general it's better to suppress them :-)

Nic;o)
Jun 18 '07 #2

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

Similar topics

4
8671
by: XmlAdoNewbie | last post by:
Hi All, I am using Microsoft SQL Enterprise Manager version 8.0 and have created a view from a combination of 4 different tables. I would like to be able to go into sql and open the view and select a row and delete that row however this seem impossible right now. I am not sure if it's possible to delete a row from a view?? Or could it be that these tables are all interconnected and in order to delete a record that is joined to one or more...
1
6116
by: Mark | last post by:
This question refers to a main form with a continuous form subform. After an error occurs after entering several records in the subform, how can I delete all the data in the main form and all the records in the subform? I have tried undoing both the main form and the subform and I have tried deleting the record in the main form. Thanks! Mark
7
1324
by: Mathew Hill | last post by:
I am a beginner to the more technical aspects of Microsoft Access (2000) and was wondering if any one can help. I have 3 buttons on a form which add, delete and search for a record. However, when I click on the respective buttons absolutely nothing happens! I was wondering if anyone could help? The code I have is below... ADDING A RECORD Private Sub cmdaddstudent_Click() On Error GoTo Err_cmdaddstudent_Click
2
1901
by: uv | last post by:
Hi! I'm having problems submitting a new record through the form. I'm working with the wizard and I've added a control button to my form for entering entering a new record but for some reason it only works for the first record I enter. The same goes for deleting a record. It says I can't access the records, and that goes for both making or deleting. I'd appreciate your help very much, uv
1
1889
by: Coy Howe | last post by:
This one seems bizarre! We have a database consisting of a main table and 12 - 15 "sub" tables, which are connected via cascading relationships. The database performs many complex calculations and displays the results in both forms and reports. In the process of developing the database we "entered" 12 sample clients. Before packaging the database we remove the sample clients by deleting them from the main table, which cascades the...
1
2397
by: KC | last post by:
Hello, I am using Access 2002. WinXP, Template from MS called Orders Mgmt DB. I have tweaked this DB to work for our small co. It has worked pretty well up until I made the mistake of deleting about 80 records from the Orders table. 80 out of a 1000 records. Now our data entry form shows our customer addresses, but not customer order history. When looking at all of the tables, customer, payments, orders, they still have all of the...
19
2149
by: MaXX | last post by:
Hi, I hope I'm not OT. I have the following issue: I want to delete a record from my db with a php script. Let's say I'm auth'd and I want to delete the record id 440. With a simple form (get or post), I send the id to my script and delete the record (DELETE FROM table WHERE id=some_validated_input). The problem is if I'm a nasty guy I just write my own form and delete any
2
4402
by: azmiza | last post by:
Hi everybody, I need your help. I want to view my sql database and its work very well which is display in my web browser but once I want to press button yes, its not working, I check the database the specified row was nit deleted Here I put my script for both. <?php #script view_users.php pg 279
1
1151
by: anco85 | last post by:
Hi. Im a total access and VB noob and require your much appreciated help. I have a table that list all the vehicles in our company. I created a form to view this information much easier with a combo box to select the record you are looking for. All this works wonderfull. What I want to do now is create a command to delete a selected record. This aswell is easy enough. What I need though, is some form of password protection to prevent...
11
3682
by: shriil | last post by:
Hi I have this database that calculates and stores the incentive amount earned by employees of a particular department. Each record is entered by entering the Date, Shift (morn, eve, or night) and the 'employee name'. There is another table which assigns an ID to the Shifts, i.e. 1,2 and 3 for morn, eve & night shifts respectively. From the mother table, the incentive is calculated datewise for each employee as per his shift duty. In...
0
9666
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
9512
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10200
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
10145
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
9986
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
9021
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
7530
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6769
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
3
2909
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.