473,657 Members | 2,405 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Delete Info from a Table

What do I need to use to be able to make information in a table be
deleteable by a User? The table I have tracks Vacation time. It has two
fields Vacation Dates and Days taken(Default value 0). The Form used has
four rows of the above for each month of the year. The clerk inputs the
vacation dates and the days of vacation time remaining are tallied at
the bottom of the form. There are inexcess of 200 hundred employees.
Rather than have the clerk manually go through the form for each
employee and delete his or her info at the end of the fiscal year I
would like to have a Button on the form, preferably with a second chance
notification, which resets the Table to Zero. I dont belive that a make
table query is the answer but dont know what is.
Thanks
S. Graefner

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #1
3 2016
Look into using the Delete Action Query. You can pass parameters from your
form and run the query from code on the button on your form.

HTH
Paul

"Stewart Graefner" <gr*******@hotm ail.com> wrote in message
news:41******** **************@ news.newsgroups .ws...
What do I need to use to be able to make information in a table be
deleteable by a User? The table I have tracks Vacation time. It has two
fields Vacation Dates and Days taken(Default value 0). The Form used has
four rows of the above for each month of the year. The clerk inputs the
vacation dates and the days of vacation time remaining are tallied at
the bottom of the form. There are inexcess of 200 hundred employees.
Rather than have the clerk manually go through the form for each
employee and delete his or her info at the end of the fiscal year I
would like to have a Button on the form, preferably with a second chance
notification, which resets the Table to Zero. I dont belive that a make
table query is the answer but dont know what is.
Thanks
S. Graefner

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #2
Hi Stewart,

Put a command button on a form, call it cmdDeleteData

Right click on the button with the form in Design View and select
Properties.
Select the Event tab and click on the line beside On Click.
The [...] button will appear, click on this and then doubleclick on "Code
builder".
This will open the form module for your code and will write the first and
last lines of the
subroutine for you.

The code you need is below:
Paste it inside the two lines written for you i.e.
Private Sub cmdDeleteData_C lick()
Exit Sub
and then delete the duplicate first and last lines.

Code requires that your command button be called cmdDeleteData and there's a
note on
the relevant line where you need to modify the code and use the name of YOUR
table.

Suggest obviously copying your table to e.g. tblVacationsBac kup before
running this code.
Code will give you two opportunities to cancel the delete operation.

Hope this helps.
Linda
Private Sub cmdDeleteData_C lick() ' command button name is cmdDeleteData
On Error GoTo cmdDeleteData_E rr

Dim sTableName As String
Dim iResponse As Integer

sTableName = "tblVacatio ns" ' replace with your Table name

iResponse = MsgBox("Delete ALL rows from the Vacations table." & vbCrLf & _
vbCrLf & "ARE YOU SURE?", vbYesNoCancel, _
"THIS OPERATION WILL DELETE ALL THE ROWS IN YOUR VACATIONS TABLE!")

If iResponse = vbYes Then
DoCmd.RunSQL "Delete from " & sTableName
End If

cmdDeleteData_E xit:
Exit Sub

cmdDeleteData_E rr:
MsgBox Err.Description & vbCrLf & "cmdDeleteD ata"
Resume cmdDeleteData_E xit
End Sub

"Stewart Graefner" <gr*******@hotm ail.com> wrote in message
news:41******** **************@ news.newsgroups .ws...
What do I need to use to be able to make information in a table be
deleteable by a User? The table I have tracks Vacation time. It has two
fields Vacation Dates and Days taken(Default value 0). The Form used has
four rows of the above for each month of the year. The clerk inputs the
vacation dates and the days of vacation time remaining are tallied at
the bottom of the form. There are inexcess of 200 hundred employees.
Rather than have the clerk manually go through the form for each
employee and delete his or her info at the end of the fiscal year I
would like to have a Button on the form, preferably with a second chance
notification, which resets the Table to Zero. I dont belive that a make
table query is the answer but dont know what is.
Thanks
S. Graefner

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 13 '05 #3
Squirrel, Thanks for your reply, Looks great I'll give it a shot.
Thanks
S. Graefner

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 13 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
7484
by: jim | last post by:
I have two tables that are related by keys. For instance, Table employee { last_name char(40) not null, first_name char(40) not null, department_name char(40) not null, age int not null, ... } Employee table has a primary key (combination of last_name and first_name).
5
5083
by: Jucius | last post by:
Using Delphi for developing, I get and delete records from an Access Database 2000. Sometimes, It happened 3 times (but not reproductible), the application did not succeed in connecting the database. A table is corrupted and when you compact, this table is deleted with an error -1206 created. I did not find resources on this problem on the web. if somebody can help, I have to solve it by Monday (it is quite HOT !). If somebody can...
5
14642
by: Tony | last post by:
hi NG I have got a database, and from this database I want to delete a table in another database, before Iexport a new table to that other database. My question is how can I delete a table in a forein database? Thx in advance Tony
4
10627
by: Ian | last post by:
Hi, I have a problem with delete using where in clause. This is a query: delete from tab1 where id not in (select id from tab2) I calculated costs using select instead of delete: select count(*) from tab1 where id not in (select id from tab2) select count(*) from tab1 t1 left outer join tab2 t2 on t1.id = t2.id
10
2683
by: nickvans | last post by:
Hello everyone, I'm fairly new to VBA and MS Access (I'm using 2003) but my issue seems like a pretty straight forward one. I would like to delete all records found in one table from another one. I have code which grabs values from a list box (which has as its source "tblNewModPart") then uses them in a Make-Table query which creates a table called "tblRemovedParts." I would like to delete all values from "tblRemovedParts" from...
2
1666
vanc
by: vanc | last post by:
I'm trying to delete a table with just around 2000 rows. What I got is timeout error. I can't use Truncate Table, which is very quick, because I have Trigger with Delete command. Is there any way to increase timeout "time" in sql server to let my query finish? Or there is better way to do this. Any comment will help. My query is just this Delete From aTable
3
1610
topher23
by: topher23 | last post by:
I have a query that isn't working as expected. The query links to one table used for data entry and has outer joins on two tables used to display information based on choices entered. I can enter all the data I want and it works fine, and if I delete a record in the query, it disappears from the datasheet. However, if I close the query and reopen it, the deleted data is back - it didn't delete from the table. What's going on? I'm...
0
892
by: steve proctor | last post by:
run time 70 permissions denied trying to update( delete info) on a vista Pc, how do i get round this, some say MTS??? but can't find that anywhere on the vista Pc, (using VB6)created the program on my XP PC, works fine!!!but when loaded on to a vista the only parts that won't work are the Update, i tried '//////////////////////////////////// sql = "update tblBooked set book = false, bookdate = null, bookedby = null where book = true" ...
0
8420
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
8324
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
8842
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
8740
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...
0
7353
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
6176
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
5642
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();...
0
4330
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1970
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.