473,847 Members | 1,439 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Save Current Record on a Form

Ian
I am trying to save the current record on a form before opening a
report, doesn’t sound to hard does it? The code on a buttons on click
event goes like this:

DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'First save record

I used this for many years with problems using Access 97, when the
database is upgraded to Access 2000 or later I occasionally get an error
message saying “Save Command is not available now”.

I thought this might be because the record is not always dirty, so I
changed the code to:

If Forms!MyFrm.Dir ty = True Then
'DoCmd.DoMenuIt em acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'First save record
End If

This made no difference and I still got the “Save Command is not
available now”. Error message.

A friend said use this code to save the record:
DoCmd.RunComman d acCmdRefresh 'Save the record

I must admit that this works, always saves the record and never produces
an error message. My question is, what is the correct way to save the
current record? Is the Refresh method a sensible way to attain the
result is there a better method?

Regards
Oct 11 '07 #1
2 64520
Ian wrote:
I am trying to save the current record on a form before opening a
report, doesn’t sound to hard does it? The code on a buttons on click
event goes like this:

DoCmd.DoMenuIte m acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'First save record

I used this for many years with problems using Access 97, when the
database is upgraded to Access 2000 or later I occasionally get an error
message saying “Save Command is not available now”.

I thought this might be because the record is not always dirty, so I
changed the code to:

If Forms!MyFrm.Dir ty = True Then
'DoCmd.DoMenuIt em acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'First save record
End If

This made no difference and I still got the “Save Command is not
available now”. Error message.

A friend said use this code to save the record:
DoCmd.RunComman d acCmdRefresh 'Save the record

I must admit that this works, always saves the record and never produces
an error message. My question is, what is the correct way to save the
current record? Is the Refresh method a sensible way to attain the
result is there a better method?

Regards
Allen Browne has some information about this here
http://allenbrowne.com/bug-01.html
discussing different methods, pros and cons...

--
Roy-Vidar
Oct 11 '07 #2
Ian
RoyVidar wrote:
Ian wrote:
>I am trying to save the current record on a form before opening a
report, doesn’t sound to hard does it? The code on a buttons on click
event goes like this:

DoCmd.DoMenuIt em acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70
'First save record

I used this for many years with problems using Access 97, when the
database is upgraded to Access 2000 or later I occasionally get an
error message saying “Save Command is not available now”.

I thought this might be because the record is not always dirty, so I
changed the code to:

If Forms!MyFrm.Dir ty = True Then
'DoCmd.DoMenuI tem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70 'First save record
End If

This made no difference and I still got the “Save Command is not
available now”. Error message.

A friend said use this code to save the record:
DoCmd.RunComma nd acCmdRefresh 'Save the record

I must admit that this works, always saves the record and never
produces an error message. My question is, what is the correct way to
save the current record? Is the Refresh method a sensible way to
attain the result is there a better method?

Regards

Allen Browne has some information about this here
http://allenbrowne.com/bug-01.html
discussing different methods, pros and cons...
Thanks very much, this is a very useful link and shows serveral
solutions, very much appreciated.
Oct 11 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
5326
by: Tony | last post by:
Hello, I am having difficulty in getting the current record of the current form to show after pressing a command button that takes me to another form. The command button takes me to another form that I want to show the record of the previous form I left. The problem is that the form does not show any other record but the current one from the previous form. I want it to open to that current record and it does however I can only view...
2
12949
by: dixie | last post by:
I know I've asked this before, but the answer elludes me and the message has long since disappeared from my newsgroup messages. How do you save a record using vba from a button or as part of an after update event in a form? dixie
0
1199
by: Jim Bowe | last post by:
Just converted an Access2000 application from SQL server datbase to a DB2 data base. When I try to edit a current record in a form and click the Save button, I get "No Current Record". I updated to the most current MSJET40.dll. Here is the code that performs the Save: Private Sub cmdSave_Click() On Error GoTo Err_cmdSave_Click DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
2
3592
by: Paul Mendez | last post by:
I have a form that consists of 150 records and is still growing. there are times when I want to print a certain record of the form, say record 12. I go to file --> print and choose the page number of the record. But what I would like to do, to decrease the amount of mistakes of print all 150+ records, I would like a button to only print the record that is currently displayed on screen. I know it can be done, I just don't know how. Any...
2
7270
by: Rosy | last post by:
I am attempting to use the following code to print a report based on the current record in the form. Users bring up the record with a parameter box and then can make changes to the sub-form on the main form (main form is locked). I use this same code for another form/report and it works. The only difference is the parameter. The one that works opens to all records and then the user uses the filter by form. I don't want them to do that...
8
12122
by: Zlatko Matić | last post by:
There is a form (single form) and a combobox. I want that current record of the form is adjusted according to selected value in the combobox. Cuurrent record should be the same as the value in the combobox. What is the solution? Thank you in advance.
2
1918
by: Tom Weston | last post by:
Help I need to save the current record before sending a simple report from it as an email using an event. The following code works for old records but not for the current new one: ------ Private Sub Command254_Click() On Error GoTo Err_Command254_Click Dim stDocName As String
5
7395
by: eighthman11 | last post by:
Hi everyone: This is probably a pretty simple problem but it is driving me nuts. Using Access 2000. I have a continuous form which list several thousand inventory items. The user can enter a order quantity on any given line. I have several different error checks depending on what the user enters in the quantity text box. What I need is a way to keep the user on that current record if he has any errors. This needs to be done if he...
1
2625
by: raddrummer | last post by:
Hi gang, I'm stumped on something that I've been at for a few days and so am seeking help. I'm sending emails to managers to let them know that a performace review is due and attach a custom form for the employee referenced. I have the query working and have created the recordset. The emails are generating correctly from the recordset but I can't get the code to send the active record info over to populate a report for just the one person...
0
9892
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9734
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10991
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10653
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10347
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7888
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5725
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
2
4129
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3168
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.