I have created a form and have put a delete button on it to delete the active record. This works fine in that it deletes the record as required.
However, at the top of the form is a combo box which can be used to find records. Once a record has been deleted, it is still listed in this combo box but as #Deleted!. Closing down the form and reopening it corrects this and the #Deleted! entry disappears.
How can I get around this? Possibly by making Access refresh the form after the delete command? If that's the correct solution, how do I do it?! Otherwise, is there a better way.
All I am trying to do is insert to have a form with a "Delete Record" button on it. The problem is I don't want anyone to be able to delete a record, I would like someone to have to insert a password to confirm the delete.
I have created a button which when clicked imports a table from Excel into Access. Every month the users want to click on this, they want to update the Access table with the updated info in the excel table. My problem is that the whole table is imported again and not just the new rows which have been added in excel. I was just wondering if there was a way to have a button which when clicked it clears all of the records out of my table in access, instead of manually deleting them. So that my users can just click this and then click the import button.
I want to remove the record buttons at the bottom of my form and only have a submit button. I will have a form for editing, because I don't want people to have edit access, only new record. Can this be done?
I am creating a form that includes an add and delete button on the form. I have two other databases that these buttons work with. Using the same VB code (and name of the button) in my current database gives me the following error:
"The express On Click you entered as the event property setting produced the following error: A problem occurred while Microsoft Office Access was communicating with the OLE server or ActiveX Control.
*The express may not result in the name of a macro, the name of a user-defined function, or [Event Procedure].
*There may have been an error evaluating the function, event, or macro."
My VB code is as follows for the two buttons:
Option Compare Database Private Sub add_Click() On Error GoTo Err_add_Click
Private Sub DeleteRecords_Click() Dim db As Database Set db = CurrentDb db.Execute "Delete * FROM tblJune 2005 applicants;" End Sub
I am trying to delete all records from a dabase created in access. When I click the command button, I get this message: "User-defined type not defined"
Hokay, firstly my apologies if this is the wrong subforum, but since my question revolves around the behaviour of one of my forms I guessed the thread should go here.
I have a very simple little database which I use to log RMAs (Returned Merchandise Authorizations). The database consists of three forms:
Form A - The switchboard. The main menu, works fine. Form B - The View/Edit window. Allows me to look at the records in the database and alter them if necessary, works fine. Form C - The Add window. Has the same form layout as B, but allows for adding records only. This is the one causing problems.
Now the situation is that when I enter Form C, the box for the RMA number gets autofilled out - which is correct - thus creating a new record. However, what I want to achieve is a button on the form that will allow me to quit back to the main menu without saving the record that has been created by opening the form. This is for situations where the form has been accidentally opened, or where a form has been started, but is not required to be finished.
I am building a db for reservations for my limo company. I want to have a cmd button that verifies the user to make sure she wants to delete a run. This is what I have so far:
Private Sub cmdDeleteRun_Click() Dim Response Response = msgbox("Are you sure you want to delete this run?", vbYesNoCancel + vbCritical, "Really delete run?") If Response = vbYes Then
End Sub
I don't know what I am missing for the cmd to actually delete it.
For school I have to make a application in access how to delete a selected record in the table in a subform by using a button. The subform is in the main form and the button is also in the main form
I have created a form and need to be able to delete employees from a table. I built a command button using the wizard and this is the current vb code-
Code: Private Sub cmdDeleteEmployee_Click() On Error GoTo Err_cmdDeleteEmployee_Click
DoCmd.RunCommand acCmdSelectRecord DoCmd.RunCommand acCmdDeleteRecord Exit_cmdDeleteEmployee_Click: Exit Sub Err_cmdDeleteEmployee_Click: MsgBox Err.Description Resume Exit_cmdDeleteEmployee_Click End Sub
But when I click on the button I get a message saying it would create duplicate data in the table.
I currently have a button that holds a delete command. When the button is clicked, a MsgBox pops up and ensures that you want to delete (yes and no); Yes deletes, No cancels.
Now I need to change it around a bit so that it is more secure. I would like add an 'authorization' code (password). When the msgbox appears, I would like it to have a text box where the user needs to enter in the password, if the password is correct then it would delete, if wrong then cancel.
I need help. I finish my contract tomorrow and this is all I have left
Good Evening, I wonder if anyone could help me please......... I have found Ghudsons attached ‘Browsing2’ example to be of enormous benefit/use to me when I have been creating various Databases, however I was wondering whether Ghudson or any other kind person(s) would either show or point me in the right direction as to how to create a ‘Delete’ facility which is very similar to the ‘Open’ command button on the continuous form.
I have attempted to adapt the enclosed 'coding' to see if it will come up with the result that I want, but unfortunately I cannot!
Attachment kind courtesy of Ghudson http://www.access-programmers.co.uk/forums/showthread.php?t=97787&highlight=browsing
Your help or assistance in this matter would be very welcome...........
Okay, I want to make a form with a combo box that you can choose a record and click a button to delete it.
As of now I have the records in the combo box but when i can choose a record... i can't delete. and when i cant choose a record.. i can delete. Can anyone help me???? :confused:
I need to have a button on my continuous form that deletes the corresponding record... I used the wizard to create the button, but it doesn't seem to work...
I amd having trouble putting a delete cmd button in a form that has a sub form on it. The errror reads "the record cannot be deleted or changed because table "details" includes related records".
Hi guys. I made bounded maintenance form customer table in my access db. But when I try to delete a record by clicking on the delete button I get the following error. I be happy if some one help me delete record successfully. Thanks
Code:Run-time error '91'Object variable or with block variable not set http://i5.photobucket.com/albums/y180/method007/deleteerror.jpg pic ===>delete error
Code:Option Compare DatabasePrivate Sub cmdSearch_Click() Dim strStudentRef As String Dim strSearch As String 'Check txtSearch for Null value or Nill Entry first. If IsNull(Me![txtSearch]) Or (Me![txtSearch]) = "" Then MsgBox "Please enter a value!", vbOKOnly, "Invalid Search Criterion!" Me![txtSearch].SetFocus Exit SubEnd If'--------------------------------------------------------------- 'Performs the search using value entered into txtSearch'and evaluates this against values in customerno DoCmd.ShowAllRecords DoCmd.GoToControl ("customerno") DoCmd.FindRecord Me!txtSearch customerno.SetFocus strStudentRef = customerno.Text txtSearch.SetFocus strSearch = txtSearch.Text 'If matching record found sets focus in customerno and shows msgbox'and clears search control If strStudentRef = strSearch Then MsgBox "Match Found For: " & strSearch, , "Congratulations!" customerno.SetFocus txtSearch = "" 'If value not found sets focus back to txtSearch and shows msgbox Else MsgBox "Match Not Found For: " & strSearch & " - Please Try Again.", _ , "Invalid Search Criterion!" txtSearch.SetFocus End IfEnd SubPrivate Sub Command14_Click()'''On Error GoTo Err_CmdAdd_Click '''Me.DataEntry = True '''Me.CmdFilter.Visible = False '''Me.CmdShowAll.Visible = True '''DoCmd.GoToRecord , , acNewRec If DCount("*", "Customer") = 0 Then Me.customerno = 1 Else Me.customerno = DMax("Customerno", "Customer") + 1 Me.customerName.Value = " " End If '''Exit_CmdAdd_Click: '''Exit Sub'''Err_CmdAdd_Click: '''MsgBox Err.Description '''Resume Exit_CmdAdd_ClickEnd SubPrivate Sub cmdDelete_Click()Dim x As Variantx = MsgBox(" You are abut to delete " & Me.customerName & " from this table - proceed ? ", vbOKCancel)If x = 1 ThenWith myRS.Delete.MoveFirstEnd WithEnd IfEnd Sub
I have a form based on Table A. When a yes/no tick is clicked in the form, I want to delete a record from Table B. The tables are joined by ID numbers.
I have two simple tables. I want to delete the records from Table1 that are on Table2. I've created a select query that gives me what I want but when I change to a delete query, I get this message: "Unable to delete from specified tables"
I think my problem has something to do with security but I can't figure out what to change.
I have a continuous form in which I put a command button for each record called "detail". I would like to click on the "detail" button and make it open another form containing all (and only) the info on this record.
At first I refused to use an "id" to link both forms, but finally I added the "id" in the table... however still does not work.
continuous form: "04 - GASTOS_BUSQUEDA" id field on continuous form: "Gastid"
pop-up (details) form: "GASTOS_EDITAR" id on pop-up (details) form: "editar_id"
This is what I have tried on the "click" properties of the "details" button field (called "btn_editgs"):
4) Private Sub btn_editgs_Click() On Error GoTo btn_editgs_Click_Err Dim strWhere As String strWhere = "[editar_id] = " & Me.Gastid DoCmd.OpenForm "GASTOS_EDITAR", , , strWhere btn_editgs_Click_Exit: Exit Sub btn_editgs_Click_Err: MsgBox Error$ Resume btn_editgs_Click_Exit End Sub
I have a wizard made delete record button on my form and up until today it worked fine. Now when clicked an error message comes up saying: cant find the field 'forms' referred to in your expression. I have no field 'form' in any of the tables or queries relating to this form, in any of my tables in fact, i don't have a clue what is wrong and why it suddenly wont work. Can anyone help please. Thanks
table 2 (form2) Reference (fK) workbook reference (PK) auto number
Table 3 (sub form within in form2) Reference (FK) workbook reference (fK) data Reference (pk) auto number
Each table is a form that is linked via the keys. On form 1 i have a button that is to open the form2, which it does but every time i open the form a new record is added. Why and how do i prevent this.
Then what i want to do is add a button for a new form on table 2 form but use the same reference as the record as presently displayed. How do i add new record using the same Reference but new workbook Reference?
is there a way to disable the new record option (>*) at the bottom of the form...i want my users to be able to search all records through the form sometimes, but not add any new ones accidentally (or intentionally) while doing so. :confused:
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?