Ms Access Error 2046 Accmdsaverecord
Contents |
Community Links Social Groups Pictures & Albums Members List Calendar Search Forums Show Threads Show Posts Tag Search Advanced Search Find All Thanked Posts Go to Page... Thread Tools Rate Thread Display Modes 08-21-2006, 04:50 AM
Docmd.runcommand Accmdsaverecord Not Working
#1 bhushan Guest Posts: n/a DoCmd.RunCommand acCmdSaveRecord not working Hi there I have to if me.dirty then me.dirty = false make the access project to use the sql server 2000 backend. I have a problem while executing the project the command DoCmd.RunCommand access vba save record acCmdSaveRecord It gives me following error Run-time error '2046' The command or action 'SaveRecord' isn't available now. Can any body plz help me this regards 09-06-2006, 12:12 PM #2 llkhoutx Newly Registered User Join Date: Feb 2001 Location: Houston,Texas USA Posts: 3,999 Thanks: 6 Thanked 105 Times in 103 Posts That could mean a non-updatable recordset is involved or possibly an non-autonumber index has not been created. It's hard to tell from your posting. __________________ Get the job done right, rather than do the right job. Do it fast or do it right. Teach a man a fish . . . If it ain't broke, don't fix it. Note that I don't open posted databases, period. llkhoutx View Public Profile Find More Posts by llkhoutx 09-07-2006, 12:57 AM #3 SQL_Hell SQL Server DBA Join Date: Dec 2003 Location: UK Posts: 1,318 Thanks: 15 Thanked 38 Times in 36 Posts Hi Humour me a second here try and use this instead.... DoCmd.RunCommand acCmdSave SQL_Hell View Public Profile Find More Posts by SQL_Hell « Previous Thread | Next Thread » Thread Tools Show Printable Version Email this Page Mark this thread as unsolved Display Modes Linear Mode Switch to Hybrid Mode Switch to Threaded Mode Rate This Thread Excellent Good Average Bad Terrible Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Access World Access World News Site Suggestions Introduce Yourself The Watercooler Microsoft Access Discussion General Tables Queries Forms Reports Macros Modules & VBA Theory and practice of database design Access Web Microsoft Access Reference Access FAQs Code Repository Sample Databases Microsoft Access Tutorials Microsoft Access User Groups Apps and Windows SQL S
for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Ask a Question Ask for Help Receive Real-Time Help Create a Freelance Project Hire for a Full Time Job Ways to Get Help Expand Search Submit Close Search Login Join Today Products BackProducts Gigs Live Careers Vendor Services Groups Website Testing Store Headlines Experts Exchange > Questions > error 2046, DoCmd.RunCommand acCmdSaveRecord - the http://www.access-programmers.co.uk/forums/showthread.php?t=113167 real story Want to Advertise Here? Solved error 2046, DoCmd.RunCommand acCmdSaveRecord - the real story Posted on 2014-09-04 MS Access 1 Verified Solution 12 Comments 815 Views Last Modified: 2014-10-03 Ok, this one has been batted around for over 10 years. I searched last night and found a myriad of suggestions, plenty https://www.experts-exchange.com/questions/28512100/error-2046-DoCmd-RunCommand-acCmdSaveRecord-the-real-story.html of work arounds, but no definitive explanation and solution to the problem. In my (inherited, legacy) application that i have converted to access 2013, it exhibits the same unpredictable failure on DoCmd.RunCommand acCmdSaveRecord. Unfortunately, the app has lots of form_delete, before_delete_confirm, and after_delete_confirm functions that part of the overall delete function, so converting to a recordset based delete is not ideal and is not part of the question. Currently there are both XP and 2013 clients running this app. Users are in it all day long, and it works most of the time, but occasionally, the delete fails with a 2046 error. Sometimes the users can hit delete repeatedly and get it to work. The button calls some validation code and then executes a DoCmd.RunCommand acCmdSaveRecord. If Response = vbNo Then Exit Sub End If Me![Sales Order Number].SetFocus DoCmd.RunCommand acCmdDeleteRecord SendKeys "{ESC}" End If Select all
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and policies of this site About Us Learn more about Stack Overflow the company Business Learn http://stackoverflow.com/questions/31349975/keep-getting-error-trying-to-save-a-record-in-ms-access-vba more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags http://access.mvps.org/access/RunCommand/problems.htm Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 6.2 million programmers, just like you, helping each other. Join them; it only takes a minute: Sign up Keep getting error trying to save a record in ms access VBA up vote 0 down vote favorite I kept getting an error with Me.Dirty = ms access False or DoCmd.RunCommand acCmdSaveRecord. With Me.Dirty = False it was 'invalid property', and with docmd it was error 2501. After some experimenting I tried a Me.Refresh command before the save command, and the error stopped occurring. I'm just sharing this in case anyone else gets a sticky save error (especially if it goes away after they press f5 in the debugger) - just put a Me.Refresh command before the save and it might help you out. ms access error Also if anyone knows why a refresh before the save fixes it, I'd be interested. PS: - History - after I noticed that if I pressed F5 in the debugger after I got the error, then the record actually did get saved on the retry with no further errors. Then I tried putting a dialog box up for the user in an on error handler with a resume to retry the save, and after they clicked OK the record saved and the error did not recur. That's how I guessed a refresh might help, since the dialog forced some kind of refresh. It was a kind of wild guess, but it worked. ms-access access-vba share|improve this question edited Jul 13 '15 at 13:17 Newd 2,01111028 asked Jul 10 '15 at 20:45 Bruce Zweig 1 1 It's perfectly ok to share your knowledge, so thank you. But I suggest you post your question in a Q&A format, according to the way StackOverflow works. –Barranka Jul 10 '15 at 20:49 ^ I would recommend deleting your current post and repost with something like "I was having an issue with This and fix it by doing This can someone explain why that solved the problem?" –Newd Jul 13 '15 at 12:54 add a comment| 1 Answer 1 active oldest votes up vote 0 down vote You ca
DoCmd Site Information Unable To Use Useful LinksHall of Fame What's New If you know of any other problems when using RunCommand then please let me know so that I can add details to this page. acCmdImport not supported in Access 2007 acCmdSizeToFitForm Limitations acCmdSynchronizeNow Hangs Cannot Save Position of Form Using acCmdSave in Code Cannot Use acCmdSaveModuleAsText in Code Code Will Not Run On Form Or Report Events Command Button Wizard does not use RunCommand Command is not available now Convert Macros to Visual Basic Converts Incorrectly DoMenuItem - No Equivalent How can you use an Access 2007 constant (e.g.acCmdImportAttachAccess) in Access 2003 DoMenuItem not converted Modal and PopUp Form Does Not Support RunCommand No RunCommand Equivalent to a Menu Item RunCommand Constants Truncated RunCommands That Force a Dialog Box Runtime - Server Filter By Form in Access 2002 Runtime - Filter By Form Runtime - Missing Menu Items Runtime - RunCommand action cancelled SourceSafe Commands not available for RunCommand method Timer Event causes problem with RunComand Cannot Save Position of Form Using acCmdSave in Code Problem In ver2 I had the following lines for saving the form position: (in Form_Unload) DoCmd.DoMenuItem A_FORMBAR, A_FILE, A_SAVEFORM, , A_MENU_VER20 This doesn't seem to work properly, so I changed it to: DoCmd.DoMenuItem acFormBar, acFile, acSaveForm, , acMenuVer70
DoCmd.DoMenuItem acFormBar, acFile, acSave, , acMenuVer70 Neither of these last commands seems to do what I could do in ver2. When I hit the save icon on the toolbar I get the desired result. Can someone direct me to what DoMenuItem command I should use, so the users have their forms automatically saved to the position it had when they closed the form. Solution Access 97 seems to have changed when the position of the form is saved. Place the following code in the On_Resize event. DoCmd.RunCommand acCmdSave Note: This code will not work if AutoCentre is set to yes. Return to Top of Page DoMenuItem not converted DoCmd DoMenuItem in version 2 code or DoCmd.DoMenuItem in version 7.0 code is not automatically converted to the Microsoft Access 97 RunCommand syntax, but the DoMenuItem syntax works correctly in Microsoft Access 97. DoMenuItem macro actions are automatically converted to t