A Button To Delete A Newly Created Record?

Sep 19, 2006

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.

View Replies


ADVERTISEMENT

Forms :: How To Put Cursor On Newly Created Record After Requery

Apr 14, 2015

I launch a 'CreateNewRecords' form from a 'MainForm' form. When the 'CreateNewRecords' form closes, the new record is visible on 'Main Form'.The underlying query is unsorted, so this code in the AfterUpdate event of 'CreateNewRecords' puts the cursor on the last record displayed on 'MainForm', which is the newly created record:

Forms!frmMainForm.Requery
With Forms!frmMainForm.RecordsetClone
.MoveLast
Forms!frmMainForm.Bookmark = .Bookmark
End With

However, I intend to sort the underlying query, which means that a newly created record may appear in the middle of the records displayed on 'MainForm'.

What I want to have happen is that after a new record is created by 'CreateNewRecords', the underlying query is requeried so that all current records are displayed on 'MainForm' but also that the cursor rests on the newly created record (rather than default to the first record).

View 7 Replies View Related

How Do I Get The Newly Created Key?

Jun 27, 2007

I have tables which I add a new post to. But I want to find its key. DoCmd.GoToRecord , , acNewRec
'Lot of data fills out the different textboxes
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
DoCmd.Requery
When I first save the data and the requery the you should expect the ID field on form to have the new unique number but it doesnt. Can you get the current unique ID on some other way?

View 2 Replies View Related

Can You Add The Date/time To A Newly Created Table?

Mar 9, 2007

Is it possible to have the Date/Time appear as part of the name of a table? I don't want to create and rename a table I want to run a Query that will create a Table that will have the name + date or just the date.

Example

"Todays file 20070308 11:10:34 AM"

or
"2007080308"

Or
"2007080308 11:10:34"

View 3 Replies View Related

Forms :: View Newly Created Records?

Jun 10, 2014

I have a piece of code that is creating new records when the form loads using recordsets.

I need a subform to show only the newly created records

View 14 Replies View Related

Auto Delete Record Button

Oct 7, 2005

Hey.

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.

Thanks in advance for your help.

View 8 Replies View Related

The Delete, Add, New, And Next Record Button; How Do I Get Ride Of It?

Aug 24, 2005

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?

Scott

View 1 Replies View Related

Delete Record Button On Form

Jul 31, 2006

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.

Thanks in advance,

Gary

View 6 Replies View Related

Add/Delete Record Button Error

Aug 2, 2006

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


DoCmd.GoToRecord , , acNewRec

Exit_add_Click:
Exit Sub

Err_add_Click:
MsgBox Err.Description
Resume Exit_add_Click

End Sub
Private Sub delete_Click()
On Error GoTo Err_delete_Click


DoCmd.DoMenuItem acFormBar, acEditMenu, 8, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acEditMenu, 6, , acMenuVer70

Exit_delete_Click:
Exit Sub

Err_delete_Click:
MsgBox Err.Description
Resume Exit_delete_Click

End Sub


Any ideas on what may be the problem and how to rectify this error? All help is appreciated. Thanks in advance.

View 1 Replies View Related

Delete All Record Using Command Button

Nov 7, 2004

Hello all:

Code:

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"

Any suggestion on how to fix this error?

Many thanks in advance,

Dion

View 4 Replies View Related

Delete Current Record Button

Dec 11, 2004

read other threads, read and used the codes, but it wont work.

i want: in a form, the record i´m looking at, when i press the "delete record" button, that the current record is removed from the table.

only thing i´ve achieved is deleting all the records (godbless backups!)

it all looks pretty clear but if you need more info just ask.

thanks

View 2 Replies View Related

Modules & VBA :: Delete A Record With Custom CMD Button

Jul 12, 2015

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.

View 3 Replies View Related

Insert Button That Delete Current Record

Nov 5, 2011

i insert a button that delete current record but i want when click on button the following message will not appear.

View 1 Replies View Related

Modules & VBA :: Delete A Selected Record In A Subform By Using A Button

Jan 12, 2014

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

View 14 Replies View Related

Modules & VBA :: Delete Table Record - Command Button?

Jun 27, 2013

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.

View 13 Replies View Related

Export Newly Entered Record To Excel

Oct 6, 2006

Hi All,

I have a form from with a button that exports data in to excel using the following on click code
DoCmd.OutputTo acOutputQuery, "qrySoftPDR2", acFormatXLS, "FOBPDR.xls", True 'open in Excel
The problem is that if I go in to an existing record it works fine.
However if I have just input the record then it comes out blank. I'm guessing there is some sort of record update code I can use, but I've been unable to figure oput what it may be,

Thanks again

View 1 Replies View Related

Modules & VBA :: SQL String Does Not Retrieve Primary Key Newly Added Record

Jul 2, 2014

I have an Access 2010-form which inserts a record in a MS SQL 2008-database by using an ADODB-connection. I need to retrieve the primary key of the newly added record.

With code at the bottom I create a SQL-string which is stored in variable strSQL. If I execute the SQL-string directly in a MS SQL 2008 Query Window, the record is inserted and the MS SQL 2008-result pane shows a column "ID" with the primary key of the newly added record.

If I execute same SQL-string in MS Access 2010 the record is inserted. However, the code fails on Debug.Print rs![ID] with error "Item cannot be found in the collection corresponding to the requested name or ordinal". Same error appears if I use Debug.Print rs.Fields(0). I've enable the reference "Microsoft ActiveX Data Objects 2.8 Library". It looks as the recordset rs is closed as soon the command "Set rs = cn.Execute(strSQL)" finished.

Why I can't retrieve the Primary Key with VBA-code below?

Code:
Private Sub cmdSave_Click()
dim cn As ADODB.Connection
dim rs As ADODB.Recordset
set cn=New ADODB.Connection

[Code] .....

View 1 Replies View Related

Access 2010 - Delete Form Command Button With A Password To Confirm Delete

May 6, 2014

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.

View 13 Replies View Related

Tables :: Add A New Child Record When Master Record Is Created?

Dec 21, 2012

I have a master table with about 40 fields. In addition, I created eight child tables with read only datasheet views of limited fields from the master table. The child table views are based on certain critera in the master table and are being refreshed by using delete and append queries tied to the On Current property of a form. By double-clicking a specific child record, a form is opened to allow editing of the master record. Also, I am using Referential Integrity and Cascade Update Related Fields to update the child table when a change is made to the master. However, I do not know how to add a record to one or more child tables when a record is added to the master table. The new child record would have to be based on the same critera that the append queries use so it gets added to the correct child table or tables.

View 5 Replies View Related

Email Each Time New Record Is Created

Jan 10, 2013

I'm working on a database to create service tickets for a small IT Department. I've created a form that would be sent via email using the collect data option. The thing is that I want to send an auto-response email each time a new record is created to the person(IT user) submitting the data. What is the best approach for this?

View 1 Replies View Related

Blank Record Created When Closing Form

Nov 4, 2005

I have a statistical program and the user constantly use the form to check calculations and get out without saving a record. In order to allow this with out writing to the table I used unbound fields and an accept and close command buttons.

This worked well until I added a subform to one of the forms. Now, if I just open that form and then click the close button, I get a blank record in the table associated to the main form. Is there a way to stop this?

View 1 Replies View Related

Unique Number To Identify Each New Record Created

Sep 23, 2011

Example 1:

2011-1
.......
2011-3893 etc.

Currently I have an Access form which produces a new unique number to identify each new record created. To do this I use the unique ID autonumber from a table to identify the new records. I would like to change from this simple number to the the above format per example 1. The four digits to the left of the hyphen would always be the current year and digits to the right of the hyphen would be the unique auto incrementing numbers such as from my table. I need the year to auto increment by 1 each September 30th (new business year) and I need the numbers to the right to auto reset to 1 to start uniquely identifying records again for the new incremented year. As each record is closed I need the number to be written as a single entity in the new format to my database.

Example 2: After September 30th.

2012-1
.......
2012-447 etc.

View 3 Replies View Related

How To Display Specific Field From Last Record Created

Nov 7, 2012

I created a template called "AD - Assembly". In this table I have fields for:

"AD_ RecNum" - This is the auto generated number field for each record, and also my Primary Key
"Document Number" - This is the number that is being assigned to each document placed in this table. (i.e. AD-0001-001)
"Description" - This is the description of each of the documents
"Originator" - This is who is assigning the document a number
"Origination Date" - This is a =CDate(Now()) field that will automatically generate the date and time the document was assigned a number.

I then created a form called "AD - Assembly". On this form I created a field called "Last Record". I want to open the "AD - Assembly" Form, and have this "Last Record" field automatically filled with the "Document Number" filed of the last created record based on the "Origination Date" field.

View 8 Replies View Related

Resetting A Mulitple Select List Box When New Record Is Created

Aug 20, 2004

I have created a form in access that contains a multiple select list box and a command button "New Record," that creates a new record. I select values in the list box for the current record. When I click on the "New Record" button, the values that I selected in the previous record are still selected. How can I reset the list box so that no values are selected when I create a new record?

View 8 Replies View Related

General :: Fill In Date Automatically When New Record Is Created

Dec 18, 2012

I would like to have a date control on a form filled in automatically with the current date when a new record is created (the date would remain as is unless changed manually). I've tried programming it in VB but, being a newbie, have not been able to come up with anything that works. I'm not even sure how to trigger an event to do it just the one time when the record is created.

View 2 Replies View Related

Automated Email Notification Every Time New Record Created

Dec 7, 2011

How can I send an automated email notification everytime a new record is created. I have a macro set up with the send object completed, I just can't figure out how to tweak the logic so it will do it everytime a new record is created.

View 5 Replies View Related







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