Docmd.Save

I'm using the following code to save my record before printing it

If Me.Dirty Then Docmd.Save

I'm getting an error saying I have not specified the object
Do I have to specify 'table' and the table name each time I use this 
statement, I thought it defaulted to the current object?
0
Utf
3/19/2008 8:50:01 PM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies
1555 Views

Similar Articles

[PageSpeed] 20

"mscertified" <rupert@tigerlily.com> wrote in message 
news:CE644884-31D0-4428-B1B0-D0E792B1F87A@microsoft.com...
> I'm using the following code to save my record before printing it
>
> If Me.Dirty Then Docmd.Save
>
> I'm getting an error saying I have not specified the object
> Do I have to specify 'table' and the table name each time I use this
> statement, I thought it defaulted to the current object?


That command doesn't save the record;  it saves design changes to an object; 
for example, a form or report whose design you've changed.  You should use 
one of the following instead:

    RunCommand acCmdSaveRecord

or

    If Me.Dirty Then Me.Dirty = False


-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)

0
Dirk
3/19/2008 9:02:44 PM
"mscertified" <rupert@tigerlily.com> wrote in message 
news:CE644884-31D0-4428-B1B0-D0E792B1F87A@microsoft.com...
> I'm using the following code to save my record before printing it
>
> If Me.Dirty Then Docmd.Save
>
> I'm getting an error saying I have not specified the object
> Do I have to specify 'table' and the table name each time I use this
> statement, I thought it defaulted to the current object?

Just use:

If Me.Dirty Then Me.Dirty = False

(Yes, the Dirty property is read/write)


0
Stuart
3/20/2008 3:15:28 PM
Reply:

Similar Artilces:

setting Save in of a CFileDialog
I would like to make sure that the user saves an edited file in the Working directory from which my app was launched. However, sometimes the default folder shown in that box is not correct. I note that there is a 6th parameter for that dialog (currently not used) that might do this. Is that correct, and if so what should I set it to? Thanks, E-Jo //At the start of the Application char str[256]; GetCurrentDirectory(strlen(str),str); m_WorkingDirectory.Format("%s",str); //When you Declare an instance of CFileDialog as below then set the initial //directory CFileDialog Fi...

How do I open a previously saved version of a workbook?
I need to recover a workbook that I saved earlier before i modified it. Hi without a backup not possible -- Regards Frank Kabel Frankfurt, Germany "BAW" <BAW@discussions.microsoft.com> schrieb im Newsbeitrag news:11717C9F-5189-4362-A0EB-1ED095A967F3@microsoft.com... > I need to recover a workbook that I saved earlier before i modified it. ...

Save as Problem
I have a 20 page marketing guide that built in 2003 version. I try to save in the 2000 format but it locks up my pc every time. Is there any way to do this effectivly? Is there any way to view the document on an older version? Does the problem occur if you create a Newlsetter print publication right out of the design sets in Pub2003, then try to save that as a Pub2000 file? I'm just wondering if this is a file specific issue, or happens right across the board. If the problem even happens with the template, we're likely looking at some interference (such as a 3rd party app) in yo...

Word can't finish to save the document due to a file permission er
I have an MS Office XP instalation in a VMWare virtualized XP sp2. Everything works fine except when a regular user, not being in the administrators group tries to save a word document gets the following error: "Word cannot finish to save the file due to a file permission error". I do not know if the original error message in English is exactly the same, I had to translate it backwards form Spanish. It does not matter if you create a root folder and give it full permission to all users, the same message apears. If you make the regular user join the administrators group ...

How save SORT?
An using MS Office 2002 Excel. Have various worksheets that I always sort a certain way... let's say address list is sorted Column B, then Column A, then Column C. Problem is... everytime I go to sort, I have to re-enter this. Is there a way to save it for a specific worksheet file? Not sure, but it seems like some worksheets save it (it pops up with this sort criteria), others don't. Thanks Have you tried to record the steps as a macro (Tools|Macro|Record) Then assign the macro to a button; View|Toolbars|Forms - drag the small rectangle icon onto the sheet and assign your macr...

How convert Docmd.Domenuitem
I'm converting a 97 db to 2000. A form has a button that executes a Docmd.Domenuitem command. This is supposed to invoke Find and Replace. It does, but the subject is grayed out. I need the find to be based on the control where the cursor was when the button was pressed. Any ideas? Access help in 2000 does not even mention this command neither does my Access book. Maybe you need to do Screen.PreviousControl.SetFocus DoCmd.RunCommand acCmdFind or DoCmd.FindRecord On Thu, 29 Sep 2005 13:43:03 -0700, "mscertified" <rupert@tigerlily.com> wrote: >I'm converti...

Save Dialog pops up now
I have a macro that creates my file and then saves it. I've just recently upgraded to Office 2007, and now Excel prompts me to save the file when it didn't before. I'm doing a SaveAs, and specifying the path\filename. Can I turn off the "Do you want to save" message and just do it? Code follows: Public Sub SaveExcelReport(strFullName As String) Dim objFS As Object Dim strFolder As String On Error GoTo SaveExcelReport_Error: ''Create reports directory if it doesn't exist Set objFS = CreateObject("Scripting.FileSystemObject")...

daylight saving
when i try to add a "new all day event" i receive this message "this time is not valid due to daylight saving time" how can i stop it? yasser yasserma98;143128 Wrote: > when i try to add a "new all day event" i receive this message "this > time is > not valid due to daylight saving time" > how can i stop it? > yasser What date and time are you trying to make it for? If it falls during the period when the time changes, you'll get this error. Ie, if you try to make for the 2AM the day DST starts, it wont work since the...

Creating/Saving Templates
I've created a Quotation Template for my company and would like to save it as a template so that when someone uses the document and fills it out it prompts them to "Save As" rather than "Save". This way the original blank document is preserved. However, when I save it as a Template it doesn't prevent another user from saving over it. Does anyone know how I can lock the "Save" function? So that only the "Save As" is available? The absolute safest way would be to put the file on a network drive that only you had read/write/delete a...

Last Saved date
Hi Please help a newbie. Kindly, someone show me how I can make a content of a cell to show "the last time the spread sheet was saved". This cell in question is part of the same spread sheet. The save function can be (both) when the file is still open or right before it's closed. The content of a cell should reflect (in date format) when the sheet is saved. Thanks in advance. Yepps Hi use the following UDF: Function DocProps(prop As String) application.volatile On Error GoTo err_value DocProps = ActiveWorkbook.BuiltinDocumentProperties _ (prop) Exit ...

Is it true about DoCmd.SendObject
That DoCmd.SendObject will find your default Mail client? -- Thanks in advance for any help with this......Bob MS Access 2007 accdb Windows XP Home Edition Ver 5.1 Service Pack 3 "Bob Vance" <rjvance@ihug.co.nz> wrote in message news:u91TwlG3KHA.4964@TK2MSFTNGP05.phx.gbl... > That DoCmd.SendObject will find your default Mail client? > > -- > Thanks in advance for any help with this......Bob > MS Access 2007 accdb > Windows XP Home Edition Ver 5.1 Service Pack 3 > > It's true if your default Mail client is Outlook :~) ...

Save As Screen Too Big
Version: 2008 Operating System: Mac OS X 10.6 (Snow Leopard) Processor: Intel When I try to save a document in Word, the SAVE AS screen is way to big. I do know the basics of how to make a window smaller. I cannot get to the bottom right-hand side of the window to resize it. Nor can I get to the top to shrink or stop with a different colored buttons. The way this occurs is when I go FILE, SAVE AS,and then push the little triangle to open the screen. In fact, I cannot get back to little triangle. It is like this one window was designed for a much larger screen. This is very frustrating. Un...

have saved a doc, and its overwritten everything, how can i undo
I have saved a document by accident, overwriting all the data, is there anyway i can recover the document in its original form? If you didn't save a backup, probably not. "forks" wrote: > I have saved a document by accident, overwriting all the data, is there > anyway i can recover the document in its original form? ...

Opening saved Excel files
When I open any saved Excel file the program will open a blank 'Book 1' and then open my pre-existing spreadsheet in a new window - how can I stop Excel opening a blank Book 1? I am using Office Pro 2003 and file share on my PC and wirelessly networked laptop - Excel opens files on both the PC where I save my docs and on the laptop in the same way. Ray If you are first opening Excel and then opening the desired workbook, creating Book1.xls is normal. If you're opening the workbook by using Windows Explorer and finding the .xls file and double-clicking to open it direct...

My Save As menu is not working
Save As under the file menu in Excel is "grayed out" so I cannot select it. How can I fix this problem Hi, right-click the menubar select Customise from list >> Toolbars click Standard click Reset Button ok - Mark >-----Original Message----- >Save As under the file menu in Excel is "grayed out" so I cannot select it. >How can I fix this problem >. > ...

Help with "Form DoCmd.Open and DoCmd.Close
The following two lines of code is not operating correctly. Private Sub cmdChangeVendor1_Click() DoCmd.Close acForm, "Invoice by Market Reviewer" DoCmd.OpenForm "Selections Vendor and Reviewer", acNormal End Sub When I click on the cmdChangeVendor1 button, I expect the form "Invoice by Market Reviewer" to close and the form "Selections Vendor and Reviewer" to open. But that is not the result I get. The form "Invoice by Market Reviewer" closes but that is about it. Nothing else opens. I have two forms that behaves this way. I have ...

When I close a form with DoCmd.Close I get a parameter popup
This is a repost. I will try to explain the problem a little better than I did the last time. When I execute DoCmd.Close on one of my forms I get one of those little unknown parameter popups, the kind you get when there's something wrong with your query. But all I'm trying to do is close the form, not read any data. This popup appears to be gernerated by the row source query in a list box on the form. This row source query references another text box on the form and this appears to be what the popup is asking for. But there's a value in this text box. And why should th...

IE8 Title bug
According to Microsoft Connect (https://connect.microsoft.com/IE) I should report a possible bug in this newsgroup. When I want to save a webpage I sometimes get the message "This webpage could not be saved". I discovered that this was caused by the 'title' tag of the html document. It seems that the error message is shown whenever the 'title' tag exceeds 259 characters. I use Windows Vista Ultimate 64-bits and tested IE 8.0.6001.18828 both 32-bits and 64-bits version. ---------------- This post is a suggestion for Microsoft, and Microsoft respon...

Page Orientation will not save within a document in Publisher 2007
Is there a way to save the page orientation setting permanently as landscape (or portrait) within a Publisher document (not the program, just one document). I've seen other solutions to this issue that say 1) just use print preview and change it as needed, 2) set your printer by default to the orientation you want (landscape or protriat), and 3) print to PDF. None of these are realistic: 1) Print preview is extra steps for my staff. They want to just open and print, or open make a small change and print, not worry about orientation everytime, with every Publisher document. 2) Def...

how do i save a visio drawing as jpeg
could you please answer the above question? best regards lamia consider file => saveas, then select jpg from the scroll list al "lamia" <lamia@discussions.microsoft.com> wrote in message news:4067A475-0DA5-46F6-81DD-FF6195F841D2@microsoft.com... > could you please answer the above question? > best regards > lamia ...

docmd.runcmd SQL functions
I have a table with fields a,b,c,d. If I have a row (x) where x.d is blank, I want to search the table and see if there is a row (y) such that x.c=y.c and x.b=y.b and if y.d is not blank, then I want x.d to be filled in with y.d. I can't seem to figure out how to start this. Thanks Carl Frankly, you don't want to do this. You have an un-normalized data model and you are storing redundant data. If b and c determine d, then that should be stored *once* a record in its own table. -- --Roger Carlson MS Access MVP Access Database Samples: www.rogersaccesslibrary.com Want ans...

Problem When Saving As...
I am having a difficulty. When I open a workbook, or template, after modifying it, I receive a message that says the folder I am trying to save it to is not accessible. The error message says, "The folder may be located in an unavailable location, protected with a password or the filename may contain a / or \" The filenames do not contain a / or \ and the locations are not password protected or unavailable. The oddest part is that this only happens sometimes. Anyone know what's wrong? Just a guess: Any chance you're saving to a LAN drive that maybe got disconnected? M...

How do I re-save a file in money ?
So I have files in Money - when I go to update them. I am invited to save to a new totally new file. How can I just save ? ( as in MS Word etc) I'm not sure what you mean by "update". In general, you don't ever "save" a money file unless doing something esoteric like a file restore. Please identify version, exact message, precise circumstances, etc. "rodeo" <rodeo@discussions.microsoft.com> wrote in message news:99820D77-3242-4F5B-856B-9827DCB63706@microsoft.com... > > > So I have files in Money - when I go to update them. I am i...

DoCmd.FindRecord Error
My code has a function to find a record. The function is called by 2 separate search forms, each of which generates SQL for a query that builds a table of record keys of all qualifying recs. When there is only 1 qualifying rec, the function is called to open the primary form (Member Data) to the qualifying rec. The function uses the rec in the new results table ( a long int ) as the argument for the FindRecord. When called by 1 of the forms, it works properly. When called by the second form it fails on the DoCms.FindRecord line with Runtime error 2162: "A macro set to 1 of th...

Edit and save query criteria
I have 2 Select queries where the results criteria changes on a yearly basis for 2 fields. There are 6 tables referenced in the queries. Only 2 tables referenced with 1 field each where the criteria would be changed. How could a user edit and save these changes? These are very Novice users of a database who would not have access to the open database. This was a homegrown database, but now trying to make it useable for others who have little to no experience. Thanks for any and all suggestions. -- DN One way would be to use a parameter prompt where the users are prompte...