473,396 Members | 2,098 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,396 software developers and data experts.

Data entered via a Form not "sticking"

15
I was working with a user who was using an Access file I created. The previous day two people had been entering some data into the file. Everything appeared to working and they thought the entries they made were actually staying put. When I stopped by the next day we went to use the newly entered data, but discovered it wasn't there. The person I was working with was in the room watching the other two make their entries.

So, we decided to re-enter the same data. I sat with her and watched as she took care of it. After updating a record she clicked on the Save button I created. The code I use is:
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acCmdSaveRecord
Once again, the data didn't stick. This time I did the updating and for some reason it all worked. I didn't do anything different. I did exactly what the other person did, but it worked (great for my reputation of having magic fingers; horrible for my reputation of creating an Access database that they trust)!

Then, the same thing happened to another user a few days later, who is located in a different school. I'm stuck with a method to figure this out and prevent it in the future.

Here are the particulars in case it helps:
  • Windows 7
  • Microsoft Access 2010
  • Initially working off of a network server
The original users were working off a network server. The next time I relocated the file onto the user's computer.

Everything I've been able to find about this is pretty old (Access 2000 and 2003) so I'm hoping with a newer version someone has figured out what to look for.
May 16 '16 #1

✓ answered by zmbd

Well, not a lot to work with here;

+ The very first place I would work with is your IT-dept, make sure that your users have a true connection to the database and not an image, or a heavily buffered VPN, etc...

++ You point out that you had no issues, I am guessing that you logged on to the network under your user profile, this leads me to a similar issue I've had in the past! Double check with IT that your users have at least read/write/modify permissions to the folder. They need to be able to read the file, write new files, and modify the existing file structure - in that folder/directory.

As I mentioned, I've had occasion where I've had read and write permissions and was able to open and use the database only to have the data revert... weird, no explanation why, My IT-Guru didn't "get it" either; however, adding Modify to the privileges fixed the issue.

+ Next, have your problem user(s) enter a few records.
Typically there will be a "pencil" icon on the record while it is being edited.
BEFORE THE USER CLICKS or changes the focus from the current record to ANYWHERE ELSE on the form - the record needs to be in edit mode - have the user press <ctrl><s>. This explicitly saves the currently edited record.

close and reopen the database - see if the data stays.

+ Change your "save and close" button to:
Expand|Select|Wrap|Line Numbers
  1. If Me.Dirty Then
  2.    Me.Dirty = False
  3. End If
  4. docmd.Close _
  5.    objecttype:=acForm,objectname:=me.name, _
  6.    save:=acSaveNo
The save:=acSaveNo will prevent any changes your user may have made to the form from being saved to the DESIGN.

Most of my forms, especially subforms, I have just the IF-Then in the on_close event
Expand|Select|Wrap|Line Numbers
  1. If Me.Dirty Then Me.Dirty = False
notice just the one command thus no need for the end if. This helps ensure that any open records are flushed.

+ You might want to take a look at Allen's info on this too
Allen Browne: Losing data when you close a form

4 1311
zmbd
5,501 Expert Mod 4TB
Well, not a lot to work with here;

+ The very first place I would work with is your IT-dept, make sure that your users have a true connection to the database and not an image, or a heavily buffered VPN, etc...

++ You point out that you had no issues, I am guessing that you logged on to the network under your user profile, this leads me to a similar issue I've had in the past! Double check with IT that your users have at least read/write/modify permissions to the folder. They need to be able to read the file, write new files, and modify the existing file structure - in that folder/directory.

As I mentioned, I've had occasion where I've had read and write permissions and was able to open and use the database only to have the data revert... weird, no explanation why, My IT-Guru didn't "get it" either; however, adding Modify to the privileges fixed the issue.

+ Next, have your problem user(s) enter a few records.
Typically there will be a "pencil" icon on the record while it is being edited.
BEFORE THE USER CLICKS or changes the focus from the current record to ANYWHERE ELSE on the form - the record needs to be in edit mode - have the user press <ctrl><s>. This explicitly saves the currently edited record.

close and reopen the database - see if the data stays.

+ Change your "save and close" button to:
Expand|Select|Wrap|Line Numbers
  1. If Me.Dirty Then
  2.    Me.Dirty = False
  3. End If
  4. docmd.Close _
  5.    objecttype:=acForm,objectname:=me.name, _
  6.    save:=acSaveNo
The save:=acSaveNo will prevent any changes your user may have made to the form from being saved to the DESIGN.

Most of my forms, especially subforms, I have just the IF-Then in the on_close event
Expand|Select|Wrap|Line Numbers
  1. If Me.Dirty Then Me.Dirty = False
notice just the one command thus no need for the end if. This helps ensure that any open records are flushed.

+ You might want to take a look at Allen's info on this too
Allen Browne: Losing data when you close a form
May 17 '16 #2
NeoPa
32,556 Expert Mod 16PB
zmbd:
the double save may be a bit overkill; however, it doesn't hurt things.
I was going to jump in anyway, but this I had to comment on.

What you have there is not a double-save! That is a good save (Albeit weird code as that is how Access has been designed.), followed by a save of the design of the form. In my view that is harm. Many designers allow design changes to be saved by users whenever they close a form after changing the sort or filter. I believe that's a limited approach. User's have no qualifications for changing the design. The design should always be as the designer left it (IMHO).

Back to the question though - Allen Browne's page is helpful on this. If the save fails then it won't always tell you - especially if saving and closing together. It's generally good practice either to check all the data is valid prior to issuing the save, or to check the error status afterwards in case it failed. I'm guessing you have an On Error Resume Next line in your code. Otherwise I'd expect the save to cause Access itself to prompt you.
May 19 '16 #3
zmbd
5,501 Expert Mod 4TB
Neopa, good point, and one I should have thought of... I'll change line-6 to reflect that.

:) - of course, there's error trapping.... :)
Never leave home without it!

Also in my code I have data validation either at the table level, before_update, and/or after_update events.

For context:
I usually allow the user to re-order the columns in the datasheet views and a few other options such as custom filters. Most of my end-users are Chemists and quite familiar with what happens, hence the save:=AcSaveYes; however, that more than likely isn't the case for the majority of situations.
May 20 '16 #4
MrYoda1
15
Thanks for the help with this one, and the suggestions, as well.

Unbeknownst to me the problem turned out to be permissions set on the folder and file in question. Since I don't have access to any of the permissions it was serendipitous that I accidentally discovered the folder permission was set to Read Only!! I'm not sure why that was the setting since it wasn't something I suggested the user seek to accomplish. I wasn't aware that any of the tech support people in the building even knew the server folder existed.

Regardless, a valuable lesson learned. In the future I will definitely find a way to have the permissions changed, if necessary--before anyone attempts to enter any data!

To be honest, a part of me is happy and relieved with the cause. At least I know it wasn't something I did. Since everything had always worked in the past it was odd that it suddenly stopped working.
May 26 '16 #5

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

Similar topics

2
by: Iain Miller | last post by:
Struggling a bit here & would be grateful for any help. I have a table which has a list of people in it. Each person has a unique ID automatically allocated by Access but also belongs to one of 5...
1
by: Mojca | last post by:
I have a problem with a report of data entered on the current day. Data are enter in a continous form. In this form I have field named Current_date_entered_data – text box which has default value...
4
by: intl04 | last post by:
How do I create a data input form in Access that is external to the Access database to which it's connected (if that's possible, which I believe it is)? For example, if someone clicks on an Access...
5
by: Aspnot | last post by:
Background: I have a data entry form that is bound to a DataSet. This DataSet contains 9 tables and the form displays data from each table in textboxes, not a DataGrid. One of the tables in the...
2
by: filbennett | last post by:
Hi Everyone, I'm generally unfamiliar with Access form design, but have programmed Cold Fusion applications for a couple of years. I'd like to build a data entry form in Access that allows the...
2
by: seltzer | last post by:
I am using Access 2000 but I also have the 2003 version. I am working on creating a data entry form in Access for a research study. Since there is a maximum of 255 fields per table in Access, I...
11
by: dba | last post by:
Have been displaying data from database using html for some time but just recently trying to display data back to "form". Can't find answer. <form method="post" action="<?php echo $PHP_SELF;?>">...
0
by: Tyler | last post by:
Made a data entry form which is a subform. I made a continuous form that displays everything entered through the data entry form. The data entry form displays all of the records. This doesn't...
11
by: rovral | last post by:
I have a data entry form that lists the details of building sales. I know a building can sell more than once so I need to allow duplicate addresses. However, occasionally the same sale will get...
2
by: Amian | last post by:
So I'll explain to you everything that I'm doing and then let you know what I need help with b/c maybe I should be doing this a different way. I am trying to create a database for all patient...
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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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...
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
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.