473,402 Members | 2,064 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,402 software developers and data experts.

Deleting Records in the Form View

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 2383
nico5038
3,080 Expert 2GB
I try to prevent to use the DoCmd.DoMenuItem command as it won't work when the menuitem(s) aren't available.

Instead I use the currentdb.execute 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
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...
1
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...
7
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...
2
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...
1
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...
1
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...
19
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...
2
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...
1
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...
11
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)...
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: 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
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...
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,...
0
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...
0
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,...
0
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...

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.