I have a form with a listbox on it and I am trying to make a button that will delete the selected records from a table. The List box is filled from a query. Any help would be very appreciated.
Table to delete records from = tbllinkPersonel_Training
listbox = lstTraining_In
_______________________________________________
Private Sub cmdDelete_Click()
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim var As Variant
Set db = CurrentDb
Set rs = db.OpenRecordset("tbllinkPersonel_Training")
If IsNull(Me.cboTraining) Then
MsgBox "No Class selected...", vbExclamation
Exit Sub
End If
For Each var In Me.lstTraining_In.ItemsSelected
With rs
.Delete
End With
Next
MsgBox "Deleted Successfully...", vbInformation
rs.Close
db.Close
Set rs = Nothing
Set db = Nothing
Me.lstTraining_In.Requery
Me.lstpersonel.Requery
End Sub
____________________________________________
Hello, I have a list box on a form which pick up excel file in my c drive. Is there a way I can delete this files via command button? Let's say I would like to select the file in the listbox, and use the button to run the delete code.
I have two list boxes on a form. The first listbox contains CATEGORIES and the second contains ITEMS that belong to respective categories. So, when i click a category the next listbox displays the items that belong to that particular category.
I need to know how to add new items to a selected category and also delete items from a selected category. If no category is selected or item already exixts, item should not add.
How to do a 'Delete from ListBox' . My listbox is populated, but I want to be able to put a button on the form, select a record from the listbox and press the button to delete that record from the list.
I should add that this is an unbound listbox so it needs to be removed from the listbox and the table that is populating it.
Listbox is List22 the table that populates it is 'tblShootingTasks'
Dim dbs As DAO.Database, sql As String, rCount As Integer Set dbs = CurrentDb sql = "DELETE * dbo_InvPrice Inner Join (dbo_InvPrice Inner Join UpdatedPricing on dbo_InvPrice.StockCode = UpdatedPricing.StockCode ) ON on dbo_INvPrice.PriceCode = UpdatedPricing.PriceCode " dbs.Execute sql, dbFailOnError
I want to find duplicate records based on FirstName and LastName and delete the duplicate. Also, I want to delete any records which have a blank FirstName and LastName.
I have a query of records that are not related to records is the secondary table. I want to delete these records but when I select the records and click delete I get the confirmation to delete answer to delete them and all the records disappear. When I run the query again, all the records are still there. Does anyone know what is happening? This is an access front end that connects to a SQL server database.
SELECT DOCSADM_PROFILE.SYSTEM_ID, DOCSADM_PROFILE.AUTHOR, DOCSADM_SECURITY.THING, DOCSADM_SECURITY.PERSONORGROUP, DOCSADM_SECURITY.ACCESSRIGHTS FROM DOCSADM_PROFILE INNER JOIN DOCSADM_SECURITY ON DOCSADM_PROFILE.SYSTEM_ID = DOCSADM_SECURITY.THING WHERE (((DOCSADM_PROFILE.AUTHOR)=21941909) AND ((DOCSADM_SECURITY.PERSONORGROUP)=4038));
Now how do i tell this query to delete these selected records from security table....?
I have a survey form that has the questions on a subform based on the response to one of the survey demographic questions (via a query based on that response). The answers to the questions are on a sub-sub form. How can I get the program to delete the answers that were entered (they are related to the primary survey form with a common ID number) if the user changes the survey response.
In other words, if the user of SurveyID 5 decides that they want to fill out the list of blue questions rather than red questions, how can I delete all the answer blue records for SurveyID 5? Right now, it will display the red questions if you change to red and enter red answers, but the blue answers remain in the database, creating 2 sets of answers for SurveyID 5.
Any suggestions...if this is not too confusing? Thanks!
I am experiencing a problem with the delete buttons I have added into my forms. I have 3 different forms that operators use, I added a delete button using the wizard on each form to delete the data if the user makes a mistake. I have allowed deletes in the form properties. My problem is that the button only works on one of the forms. I have checked the code and it is the same on all 3 forms.
The record is not deleted, all that happens is that the vertical bar down the LHS of the form flashes black, and thats about it
Private Sub Command52_Click() On Error GoTo Err_Command52_Click
I have a table that has many duplicate records. I tried importing the table and setting the field to no duplicates but did not work. How can I delete duplicate records. The primary Id id fine I have another field that I can use. it is a BAC number that is repeated many times. Here is the table I need fixed.
I am creating a web database where users submit entries using an online form. When they submit the entry, I am saving the entry date and time in a column called Timestamp. What I need to figure out is if there is a way to create some sort of expiration date, based on the Timestamp, that will automatically delete a record after it is 7 days old. Is there a way to do this? Thanks so much for any help that you can give.
how do i delete multiple records in a table, for example if i have a table that as serial_num 123 twice, how do i delete the two records, basically i don't want to delete one record, i want to delete the two records. Thanks.
I have a table of ~165k records and need to delete records that are similar (2 or more records have the same lastname, firstname, dob). These records are not duplicates as other field values in these records are different. I've tried several sql scripts and Access methodologies but can't get valid results.
On the below data I need to delete records where dep is blank or the same for the same ID. So I need to find and del recNr. 1,4,5. Any help will be appreceated!Thanks
Is there a way upon selecting a record (in a continuous form db) I could right click and delete the record? I am able to cut, copy and paste but unable to delete. Any suggestions?
Help please! I have a form (frmHalfTab) built on a table (tblHalfTab2) that has existing data in it. In the very near future, I will be uploading additional data to this table via excel cut and paste. What I want to do is search for and eliminate duplicate records that have duplicate data in TWO fields, (MemberNum) and (MBRDrug), so that if MemberNum is "10" and MBRDrug is "Zzz" for more than one record, the duplicated records need to be deleted, OR a check box needs to be checked automatically for all the identical records, the original and the duplicate(s). I wanted to put this behind a button, if possible.
Now, I have created a duplicate query that will find the duplicated records, but I'm not sure how to use it to get rid of the duplicated records or check the checkbox appropriately. Should I ditch this query and choose a different route, or am I on the right track? Thanks in advance for your help.:confused: