473,395 Members | 1,689 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

VBA - Saving Current Entry ?!?

29
Is the following correct?

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70 ' to save

DoCmd.GoToRecord , , acNext ' to auto next

Me.Requery ' requery for the hell of it


shiznaw
Jun 28 '07 #1
2 1343
missinglinq
3,532 Expert 2GB
Most people use

DoCmd.RunCommand acCmdSaveRecord

now instead of

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

to save a record. The older code is still used by the Command Button Wizard, and still works, but may be phased out in future versions.

The line

DoCmd.GoToRecord , , acNext

isn't needed to save the record.

Me.Requery

will put the new record in its proper place within the recordset, if you will. If records are sorted alphabetically, say, by a person's name, the new record will now be in the correct alphabetical position. If the Requery isn't done, the new record will be at the end of the recordset.

To sum up,

DoCmd.RunCommand acCmdSaveRecord
Me.Requery

will save the new record and put the new record in its proper place.
Jun 28 '07 #2
shiznaw
29
Most people use

DoCmd.RunCommand acCmdSaveRecord

now instead of

DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70

to save a record. The older code is still used by the Command Button Wizard, and still works, but may be phased out in future versions.

The line

DoCmd.GoToRecord , , acNext

isn't needed to save the record.

Me.Requery

will put the new record in its proper place within the recordset, if you will. If records are sorted alphabetically, say, by a person's name, the new record will now be in the correct alphabetical position. If the Requery isn't done, the new record will be at the end of the recordset.

To sum up,

DoCmd.RunCommand acCmdSaveRecord
Me.Requery

will save the new record and put the new record in its proper place.
Thanxs for clarifying. I needed that. so, umm....you guys should start charging!

shiznaw
Jun 29 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: Michael Onfrek | last post by:
Hi! I'm playing with entry again and trying to restrict length of entry widget to certain number of character, so users cannot enter more character into it. Any ideas? Reg. Michael Onfrek
3
by: LC | last post by:
Hi, I would like to know how I can save my current ASP page to the server side in html file format. Then I would like to stream it back to the client side. Any help is very much...
2
by: LC | last post by:
Hi, Many Weeks ago I posted this: I would like to know how I can save my current ASP page to the server side in html file format. I got a very nice reply back from Scott McNair. Thank you...
2
by: DMD | last post by:
How do I determine the column associated with the current edit location within a RichTextBox? The following code allow me to determine the current line txtLineNumber.Text =...
1
by: Richard L Rosenheim | last post by:
I'm trying to create a style sheet to generate HTML output, based upon some XML data. I'm grouping some data, and I'm trying to get the very first entry either just passed as a parameter, or...
6
by: sghi | last post by:
Hi All, I'm new to this group and quite new to access/vba. So, shortly after beginning to write a simple application for my wife, I came across a blocking problem: I need to intercept the sql...
11
by: jd_12345 | last post by:
On DB2 on AIX, I'm attempting to retrieve the most recent ID for each unique Code based on its EffectiveDate. For example, in the data below, I want to retrieve ID BE0191026 as it has the most...
6
by: Gilberto | last post by:
Hello I have a form where the user enters some pricing information. I need to store in the pricing table (fields time and date) the time and date WHEN the information was entered, so that later...
5
theGeek
by: theGeek | last post by:
Hi All, I want to save the current page using javascript(in asp.net). Though I could find out that the "execCommand" can do that but the only options for file types that are available in the save...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.