Deleting From A Form

Jan 3, 2006

Hello,
in my memership system everything uses forms for ease.

in the main view of the student record, you have the option to delete the member. how every some of the information is linked to another table, how would i go about deleting this information as well, when the button is pressed.

Aaron

View Replies


ADVERTISEMENT

Look Up Form, But No Deleting Of Records?

Mar 23, 2006

Hi There,

I have a form with a search field for an unique field, that looks up records in the table that belong to that unique field. See Code:

Private Sub cboLastName1_AfterUpdate()
On Error Resume Next

Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim strSQL As String


cboLastName1.SetFocus
If cboLastName1.Value > 0 Then
strSQL = "SELECT * FROM tbl24HRPolicies WHERE AutoNumber = " & cboLastName1.Value

Set db = CurrentDb
Set rs = db.OpenRecordset(strSQL)
If Not rs.BOF Then
Me.ID = rs("AutoNumber")
Me.Prefix = rs("PolicyNumber")
Me.FirstName = rs("DateReceived")
Me.MiddleName = rs("Comments")
Me.LastName = rs("ClientsName")
Me.Suffix = rs("ShopID")
Me.NickName = rs("Nickname")
Me.Title = rs("ActivePolicy")
End If
rs.Close
Set rs = Nothing
db.Close
Set db = Nothing
End If


The fields, that take content based on that search field, are unbound.
I've added the delete button, but it's not working, because they are unbound. Is there no way to delete records with this form??

View 1 Replies View Related

Deleting And Saving In Tables From Form

Oct 17, 2005

I am trying to make a database for a shop which can do several things:

1) I want to give in what is being bought by the shop to make their products form. This has to be saved in a table named STOCK.

2) I want to be able if I say in a form that from these things I made that product that these things dissapear from the STOCK table and that the final product is added to the STOCK.

3) If the final product is solled I want to remove it from stock.

In the end if I want to see what is still in the stock I will only have the things that are still there because the rest is removed.

How can I do this??

Thanks for your answer

View 1 Replies View Related

Deleting Records From A Form Using Combo Box

Mar 11, 2008

What code do I need to delete a record using a form and a combo box. I need to be able to link the selection in the combo box to a button that, when pressed, will delete the selected record.

Information:

Account Executive Combo Box - select an account executive based on a table (that contains only account executives and an autonumber)

Table name: AccountExecutives
Form name: DeleteAccountExecutive
Combo Box name: Combo300
Button name: DeleteExecutive

View 1 Replies View Related

Deleting Records PopUp Form

Mar 17, 2005

Hi All.
Is there a way show my own popup form instead of the standard "You are about to delete 1 record(s)" when deleting a record?
I have taken a look round and couldn't see that this was posted already......but apologies if it has already.

Frank. :confused:

View 1 Replies View Related

Deleting A Record Through A Button In A Form?

Mar 15, 2006

Help needed! (Apologies if this is a stupid question !)

I'm making a database for my OCR A2 coursework.

I have a table set up for tenants, and have created a form through which the user can delete a record from that table.

I have a look up combo box, to select the record (tenant) for deletion, and a command button - using the wizard that came up I have selected "delete record" - but it doesnt work! It doesn't delete the record i have selected.

Why Is this not happening ? It also doesn't bring up a warning box saying "you are about to delete one record" or something similar?

Thanks xzxx

View 9 Replies View Related

Refreshing Form After Deleting From Subform

Apr 27, 2006

Hopefully a quick one, this.

I have a form containing a subform, as a datasheet. The form displays the full details of whichever record I select in the subform.

When I click on a button to delete a record that I've selected in the subform, it vanishes and the subform row that displayed it is cleared. I have a figure displaying the total count of rows in the subform (thanks to Ghudson for that one) and this also reflects the change. the form, however, still displays the details it previously did.

As the last line in the code behind the button I have:

[Forms]![form name].Requery

however, when the code runs and hits this line, it displays a message that says

'Runtime Error 3167: Record is deleted'

Without this line, the form doesn't refresh (obviously) and I get no error messages, but when I next select any row in the subform I get a message:

'Record is Deleted'

and all the fields in the form display 'Deleted#'. Selecting another row fixes the problem.

It seems pretty clear that I'm not refreshing the form correctly, but in spite of searching the forum and finding a fair few threads on this topic I can't work out the syntax I should be using.

Hopefully, someone more knowledgable tham me can point me in the right direction.

View 1 Replies View Related

Deleting Data From A Report Using Form

Mar 26, 2014

I have a project that was given to me because I have previous experience with MS Office, but my level of Access experience is somewhat below par. Here is my problem: We are using one form (Enter Required Training) to create a row of data that goes to a report to let us know when employees need to be trained by.

This report is called 'Past Due - Required Trng'. When employees have completed a training course we go into a form called 'Enter Training Attendance' to update another report to show that they have completed training. However, once employees have completed a course, we have to manually go to the database where the required training courses are stored to manually delete them so that they do not show up on the report.

My boss would like me to find a way to automatically delete the required training information without having to manually delete them each time. Is it possible to have the 'Enter Training Attendance' form delete the record created by the 'Enter Required Training' form so that it does not show-up on the report once completed? I have been messing around with the datasheets, events and even formatting but I can't seem to get anything to work.

View 9 Replies View Related

Deleting All Related Sub Records When Deleting The "main" Record.

Apr 12, 2008

I have two tables.

1. Persons (list of persons)
2. Job history (list of jobs)

each person have their own job history. all these jobs are stored in the job history table. when i delete a person i would like the job history for this person deleted as well. each job stored in the job table have a field with person name, so that it is linked to this person.

how can i do this? vba or simple properties options?

- Roy

View 1 Replies View Related

Reports :: Error When Deleting A Record From Form

Apr 18, 2013

I'm using MS Access 2003.

I have a form that displays in datasheet view. When I select a record and hit my keyboard's Delete button, I see the following error:

The Microsoft Jet database engine stopped the process because you and another user are attempting to change the same data at the same time.

This error *always* appears when deleting any record from this form. After clicking OK on this error, if I refresh the form, the record in question has indeed been deleted.

We use an Oracle back-end, and I have tried dropping the associated triggers, but the error message persists.

View 1 Replies View Related

Forms :: Deleting Records On The Table Through Form

Oct 12, 2014

I have a form linked to a table and in my form there is a listbox reflecting the records in my table. Evereytime I tick a record in the list box the information on its corresponding columns appears on the text field.

So far I am able to add, modify and save record to my table using this form but I am having a problem on deleting a record which I selected on the listbox. I created a delete command button but it is not working. Please see attached database.

View 2 Replies View Related

Deleting A Specific Record From A Table Using A Value From A Form

Feb 23, 2014

I have a form where a user enter an ID and some details. This is saved in Table A.The ID is also in Table B - What I want is, once the user saves it in Table A-I want it to be deleted from Table B. Ultimately, Table A has all information and Table B will only have those IDs that haven't been entered in Table A. what is entered in Table A shouldn't be there in Table B.Is there a way to do this using a macro?I did find a VBA code online -

Private Sub Submit_Enter()
DoCmd.RunSQL "DELETE * FROM TBL_ClaimsToBeAssigned"
where [Claim ID] = Forms![FRM_PendsAssign]![Claim ID]
DoCmd.SetWarnings False
DoCmd.RunSQL "DELETE * FROM TBL_ClaimsToBeAssigned"
DoCmd.SetWarnings True
End Sub

View 2 Replies View Related

General :: Form With Subform Datasheet - Record Deleting

Aug 17, 2015

Currently i have a form with subform datasheet

Form from Purchase order table
Subform from serial table(Brand,Model,Type,Location,Serial) with serialtrans table(InOut,AQty,Comment)
(SELECT tbl_Serial.*, tbl_SerialTrans.*
FROM tbl_Serial LEFT JOIN tbl_SerialTrans ON tbl_Serial.SerialID = tbl_SerialTrans.SerialID

when i click on the datasheet row and delete the row it only delete the record from tbl_SerialTrans but record on tbl_Serial was not deleted

is there any way to delete it?

View 3 Replies View Related

Deleting Records From A Table Through A Form Button Event

Nov 14, 2014

I have a FrmCadastro which updates my master table TblCadastro. Primary key of the TblCadastro is an auto numbered field named CADID.Fields CPF, NAME, FIN, NAT, TIP, MOT, and INSTREQ of the FrmCadastro are mandatory. My rule is that If any of these fields is null then the record cannot be saved (cannot be added into TblCadastro).

FrmCadastro has two distinct buttons, as follows: BtSave (to save either newly included record or changed record) and BtDelete (to delete a chosen record from my master table).To delete a record has not been a problem because under the click event of the BtDelete I use the following command lines to successfully eliminate an existing record (previously saved) from the TblCadastro:Dim numRecord As Integer

numRecord = Me.CADID
Dim SQL As String
DoCmd.SetWarnings False
SQL = "DELETE * FROM tblcadastro WHERE cadid = " & numRecord
DoCmd.RunSQL SQL
DoCmd.SetWarnings True

To save a complete record (properly filled in) has not been a problem either since the code takes care of that very well.When the user is in the process of adding a new record through the FrmCadastro two different user behaviors can take place:

1. Irregular entering - The user for some reason just give up saving the record (he decides to add the new record later, for instance) by selecting the option Save = No, or
2. Incomplete record - By mistake the user try to save an incomplete record (a record that shows any mandatory field as null).

I coded the following command lines under the click event of the BtSave to take care of deleting those records... BUT it does NOT work. The system reads each line of the code, find the record properly, close the form as expected, but the incomplete record STILL REMAINS in the TblCadastro. I do not understand why, since the code is pretty much the same of the one in the BtDelete.

Code:
Private Sub bt_save_Click()
If MsgBox("The record was changed. Do you want to save it?", vbQuestion + vbYesNo, Me.Caption) = vbYes Then
If MsgBox("WARNING! Incomplete record will be automatically deleted from database. If you did not fill in the fields CPF, NAME, FIN, NAT, TIP, MOT, and INSTREQ, the record will not be saved.", vbOKOnly, Me.Caption) Then
If Not IsNull(CPF) And Not IsNull(Name) And Not IsNull(FIN) And Not IsNull(NAT) And Not IsNull(TIP) And Not IsNull(MOT) And Not IsNull(INSTREQ) Then

[code]...

What should I code to exclude both the incomplete record and irregular entering thru the button Save (options Yes and No) ?

View 14 Replies View Related

Updating Main Form When Deleting Record From Subform Datasheet

Dec 21, 2006

Hi, I have a problem I don't know how to solve it. I have a subform in datasheet view, linked to the main form. There is a running total on the main form based on a dsum on a field of the subform.
When I delete a row on the subform datasheet, the main form calculation is not automatically updated. I had to create a "update" button to do the refresh.
Is there a "on record delete" event available for a datasheet sub form?
Thank you for any help.

View 1 Replies View Related

Forms :: How To Make Form Refresh After Deleting A Record In Subform

Sep 3, 2014

I have been trying to figure out how to make a form refresh after deleting a record in a subform. The code in the combo box that populates the subform works fine. If you select the "Action" of "sign" from the unbound combo box above the subform, it places "Sign" in the the subform and then makes a checkbox on the main form [WillTake] = True.

But when I delete the record by right clicking on the entry, the focus is sent back to the main form so I can refresh the form and thus update the [WillTake] checkbox. I have tried just about everything. I can get the focus to a field on the form, but I cannot figure out how to refresh or requery the form.

The code to transfer focus is on the OnDelete of the subform.

I have included a watered down version of the DB.

View 11 Replies View Related

Forms :: Deleting Subform Data When Main Form Is Deleted

Dec 9, 2014

I have a main form with several linked by ID worksheet sub-forms. I would like to add a on-click function to delete the main form and all related record on each sub-form. I have tried several methods but nothing is working correctly. The cascading delete function is not available as part of the form relationships. How I can accomplish this?

View 1 Replies View Related

Form Based On Queries - Deleting Field From Main Table

Mar 28, 2014

In my Access2000 db, I have a table, on which many different queries are based. Many forms are based on those queries. I want to delete some redundant fields from the table. I tried deleting one, but I found I could no longer open any of the associated queries and forms. Is there a simple way to delete table fields so that it doesn't stop me from opening associated queries and forms? (There are hundreds of them, and I have a lot of table fields that I want to delete).

View 1 Replies View Related

Deleting

Feb 21, 2005

I have a problem about deleting record from a form, it will be grateful if anyone can help me with this.

Here are my tables:
Par_tor: some personal details such as ID, name, phone NO., etc
Par_tion: the record of who has participated which activities.
Activity: name of the activity.

My problem is: the main form of the my form contains the stuffs in table Par_tor, and the subform contains the stuffs in Par_tion, so the user can view these participator's details and the activities they have participated.

In the main form, I also wanted to created a delete button to delete an entire record (including a participator's detail + his/her participation record) at once, but it didn't work since the participation was in the Par_tion table not in the Par_tor.

So is there any way that I can delete these records at once?

View 4 Replies View Related

Deleting A Record With VB

Jun 15, 2005

Hi

I have a form with a "Clear Form" button on to allow the user to delete the record they are working on without updating the database. A question window pops up asking if they are sure they want to delete the record, if they answer yes the form will clear and re-load without updating the database.

The OnClick Event Procedure will not allow me to delete the data, it always saves. I've tried
DoCmd.SetWarnings False
If MsgBox("Are you sure you want to abandon changes to this record?", vbExclamation + vbYesNo, "LogBook 2002") = vbYes Then
DoCmd.RunCommand acCmdDeleteRecord
DoCmd.SetWarnings True
Else
DoCmd.SetWarnings True
End If
but I get the error "2046 - The command or action DeleteRecord isn't available now." Is there another way, a better way?

View 9 Replies View Related

Deleting Records

Aug 4, 2005

I have two tables (same data but slightly different attribute structure) with a one-to-one relationship (the join field is "ID"). There are 69 matching records in these tables. How can I delete these matching records from table A, while leaving them alone in table B?

I'm confused because I brought both tables into a select query, created a join from ID to ID (within in the query's design view), and then added all fields from table A to the query. I then ran the select query and saw the 69 records from table A in the query's data view that I wanted to delete, highlighted all records and clicked delete. However, this action deleted the 69 matching records from TABLE B, not Table A!!! How is this possible? What should I do instead? Thanks.

View 3 Replies View Related

Deleting Records

Nov 11, 2005

A strange request but I hope someone can help with this one

I have a table (tbl_Econ) where I have to delete a specified number of records from a table. It does not matter which records as long as I delete the exact number

e.g On a form text box I enter the number or records to be deleted (e.g.6000).

The table (tbl_Econ) has 8000 records, so I have to delete 6000 records. I need to be able to do this automatically :eek:

View 1 Replies View Related

Deleting Records

Feb 1, 2006

How can I go about deleting records fully? So that there autonumber, etc can be used again without access moaning.

Thanks :D

View 1 Replies View Related

Deleting Records

Mar 14, 2006

I have a query (Query1) which returns results In one field recordID.

How do I delete records in a table where the RecordID is in the list Query1.recordID?

Thanks

View 4 Replies View Related

Deleting Tables

May 11, 2006

:confused:
I am Developing a simple VBA program for Access for my final year of my Degree and I have come up with a problem that I don’t seem to be able to fix.

I have create tables using SQL

SQL = "CREATE TABLE tblInvoiceLines" & _
"(InvoiceNo LONG, PartNo LONG," & _
"Quantity LONG)"

DoCmd.RunSQL (SQL)


Deleting this with the below code works,

SQL = ""
'This will delete the Invoice Line Table
SQL = "DROP TABLE tblInvoiceLines"
DoCmd.RunSQL (SQL)


But once I alter the table with the below code the Delete command doesn’t work, does anyone know how I can fix this problem?

SQL = "ALTER TABLE tblInvoiceLines " & _
"ADD CONSTRAINT fkInvoiceNo " & _
"FOREIGN KEY NO INDEX (InvoiceNo) REFERENCES " & _
"tblInvoices (InvoiceNo) " & _
"ON UPDATE CASCADE " & _
"ON DELETE CASCADE "


conDatabase.Execute SQL


Thanks
Coops

View 2 Replies View Related

Deleting Tables

Jun 7, 2006

Hi i have a lot of linked table that i want to delete I have the macro below that deletes one at a time but i have to put in the name is there a way to delete all the ones that end in _cfd_posting as before this name there is a six digit number but these r all different is this possible

Sub delete()
DoCmd.DeleteObject acTable, "060204_cfd_postings"
End Sub

View 1 Replies View Related







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