Topics Search

Access 2007 Vba Code To Save Record In Current Form

Access 2007 Vba Code To Save Record In Current Form
Views: 17
I have an existing event procedure, on click, which saves the current account number, linked field, which opens a new record in a different linked form, and stores the account number value in that new record.

When I close that second form, an message is displayed stating the record can't be saved because it requires a related record. I added a line at he beginning of the event procedure code, "DoCmd.Save" but I still get the message the record can't be saved. What code do I need to effect a record save in the event procedure?
Sponsored Links:

More topics


Save Record for Current Date

A Save Record button, and a field with a date picker. I also have a simple VBA code that saves the last fields' values as a default on the Mouse Up event of Save Record.

If I choose any date other than the current day, I can click Save Record and everything works fine. However, if I click New Record and then try Save Record, nothing happens.

If I actually change or add a value to a field after clicking New Record and then click Save Record, it does save the record.

Save does not stay on current record in access 2007

I have a command button on a simple form created with the wizard. When adding a new record and the clicking save it does not stay on the current record. I have also tried an event procedure with the code:
docmd.runcommand acCmdSaveRecord

Access 2007 releasing saved records

I'm using a popup form to enter data in MS Access 2007. If I hit the save button to save the record and then attempt to edit a field, I get the message.

Another user editied this record and aved the changes before you attempted to save your changese.

I have code on the Form_BeforeUpdate that sets some fields on the form. If I remark these out, I do not get this error.

I'm using a form master that I have used for years to create forms. I have similiar forms updated from Access 2003 in the same Access 2007 database with the same code that work great.

I appears the Access 2007 saves the record before it can execute all the code in the Form_BeforeUpdate. I have seen some goofies like this in other events in MS Access 2007.

Tell me I'm not crazy. But if you have a solution

VBA to save values entered in a unbound form

I have a form containing unbound text boxes which the user will enter data into. I want to write some code to save the values to a table. There are four different text boxes/values I want to save for the last three rolling months (so potentially 12 values will be saved). I have the following code which stores the months in an array so that I can update each month at a time.

I keep getting an error message saying "Run-time error '3021: Either BOF or EOF is True, or the current record has been deleted. Requested operation requires a current record

Save current record on form as PDF and loop to next

I have a table and linked a form to it. My form looks nice (like a report) and has 1000's of records.

Currently I can save each record as a PDF but I have to type the file name (I use the print current record option on cute PDF) and doing this for 1000's of records is horrible.

Can someone help me to create a basic VBA code that I can click one command button and it then saves each record as a PDF using the main field and then move to the next using a loop. At the end I would like a folder with 1000's of PDF's of each of my records named after the main field.

If we can call my form "abc" and the main field / primary key for each record as "xyz" that would be great.

So with the primary key "xyz" this would have each record called "1", "2", "3" etc

I know it would have to open form abc, find xyz key and save record 1 as "1" repeat for next record and save as "2" etc

I use access 2010.

run code moving from record to another record

How can I run some code when moving from one record to another.

I know when the new record opens I can use current but whats the oppsite ie when leaving the record, not closing the form that's easy.

I might have 10 records from a search so as I scroll through them in a form I want to save some data on the record that is now not current.

Access 2007 multiple users

I've created this database by tailoring the contacts example from the Access 2007. it's just for contacts and has fields like lastname, firstname, address, etc.

When I enter details and save and look at it later, no probs. However when my colleague logs in, under another name, on his own computer and views the database at the same time, no probs.

But when one of us has updated a record and wants to save and log-out the following message appears.

"The database cannot be opened because the VBA project contained in it cannot be read. The database can be opened only if the VBA project is first deleted. Deleting the VBA project removes code from modules,
forms and reports"

If I click Cancel, the database remains opens but this message reappears if I try to look at any of the code behind the forms or reports.

Do I need to delete the VBA project? If so how can I do that? Can Access 2007, can't imagine that? or have I not clicked a check box or something?

Duplicate a record in Access

I've created a form in Access 2003/XP/2000/97 and I want to have a button on the form that duplicates the current record. What VBA code do I use to duplicate the current record in a form?

How to create a save and go to new record button without affecting Me.Undo??

How do I create a button that saves the current record and moves to a new one? I want to do it in such a way that microsoft access acknowledges the button.

Below is the following codes in my form:


I tried to create save and go to new record using macros and the wizard but I'm not sure if they even work because everytime I press the button my beforeupdate event appears. How can modifythe code such that when I press the button, it savees the record and goes to a new one without displaying my "Do you want to save updates?" message.

How to? Copy rec to new tbl then del old rec

I'm new to VBA and am building an ACCESS form that when a Button is clicked: 1. Save the current changes made to record in Table A.
2. Copies the current record from Table A to Table B (appending it)
3. Deletes the current record in Table A.

The purpose of this is to allow a user to click a button to archive the record in Table A to the archive table, Table B.

The tables are totally disconnected. Separate tables, but the fields are set up exactly the same.

Table A is the current "active" database, where as Table B is the "archive" database.

The form that is going to do this record move, first allows the user to add closing information to the record in Table A...