Access 2007 Vba Code To Save Record In Current Form
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?
Thank you for taking the time to report an issue.
What's wrong... Please write below.
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.
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
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
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.
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.
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?
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.
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...