Trying to write to one table with multiple forms in Access - mysql

After searching around the forums I can find multiple issues with having several tables and one form, however I have the inverse problem. I have four separate forms that are all linked to the same table. No two forms edit the same variable on the table.
If people open up a single form, save it, close it, then move on to the next form the database works as intended. However, some people open up all the forms and forget to save/close the one beforehand. At this point, Access refuses to save the file stating that 'Another user has this file open' since the table is open in another form, even though no variable should overwrite each other.
Is there any workaround for this? I'd just like to have people be able to save their entered data from several forms to the same table. There will be no point in time that two people would access this table simultaneously, I just want to make sure we can save the data if someone opens multiple forms at once.

First, in a MS Access database multiple users can have same forms open. The only Read/Write issue would occur if users are working in the same record. Whoever enters the record first and begins updating would have the record-locked for him/her and users afterwards would get the warning message until the record is saved (or dirty event is removed). Users may be able to view but not be able to edit.
So your issue may be more an operational than a programming one. Try to organize users to manage specific records at a certain time or coordinate add/update work between team members. Of course this would be impossible if you run over a large company network with hundreds of users or online.
Still another solution would involve migrating all separate forms as subforms into one main form, so all corresponding records align at same time. But normally, subforms are reserved for join tables and not same table record sources. You can use tabs if space is an issue. This does not stop the record-locking issue but at least reduces the chances of it since less records are spread across separate objects. In fact this may prove to be better as users can move back and forth to other variables of the same record for reference on one form instead of opening/closing other forms or keeping the other ones opened.
Finally, it is highly advised if working in a multiple user environment and especially since you are connecting ODBC to systems like MySQL to split your database between FrontEnd (linked tables, forms, queries, macros, modules) and BackEnd (only tables). This setup prevents corruption, efficiently runs systems as only data is sent across the network and not whole application items, and overall fosters a better multi-user environment. Each user can have a copy of the FE on their local machines but all will connect to one BE on a shared network. To help, Access 2007-2013 has a button for this on the Ribbon under Database Tools.

I've used a dashboard that displayed buttons to open the forms needed and then used yourform.showdialog() to open up other forms in C#. This will make it so the user cannot use other forms until the form that is open is closed.
http://msdn.microsoft.com/en-us/library/39wcs2dh(v=vs.110).aspx

Related

How to manage "releases" with MS Access

I have an MS Access 2016 application that a few people use in one department. I know this whole thing has web dev written all over it but this access database has been their process for a while and there is no time right now to switch over.
Recently, a different department wants to use this application, but having their own copy. Currently, if I need to make changes, I'll make the changes in a copy of the app, they send me a current version when I'm ready to import their data, I import it and send them back a new one. However, currently I copy the data table by table and past it into the new database. This is inefficient and tedious, and now with 2 sets of data I'd be doing this for, that's crazy. There's over 20 tables so I don't want to have to manually copy over 40+ tables across the 2 apps for even the smallest change like altering a message to the user.
I know I can copy the code so I can avoid importing the data, but sometimes for big changes I'll change over 15-20 vba files.
So, a couple questions:
1.Is there a way to generate insert statements for the entire database that I could run in a script? So when I create the new copy I just upload 1 file and it populates all the data?
2.Are there any kind of dev tools that will help this process? Right now I'm thinking that it's just a downfall of creating an MS Access app, but there must be some way that people have made the "new release" process easier. My current system seems flawed and I'm looking to have a more stable process.
EDIT:
Currently I have all my data stored locally, attached to the same access file as the front end. Since I will have 2 different departments using the same functionality, how do I manage the data/the front-end? These 2 departments should have their own access file to enter data using the forms, so having 1 front end between the 2 departments won't work.
Also, should I create 2 separate back-ends? Currently I would have nothing to distinguish what is being inserted/changed/deleted from one department from the other. If I were to attach a field specifying who entered the record, that would require a complete overall of all my queries which I don't have the time for as there are deadlines I need to meet.
First thing is to split the database. There is a wizard for this.
Then you can maintain the frontend without touching the real data.
Next, consider using a script to distribute revised versions of the frontend. I once wrote an article on one proven method to handle this:
Deploy and update a Microsoft Access application in a Citrix environment

Limit access to a database to a few users. (MS Access 2007)

I would appreciate if someone would help me with this.
I am new to Access and my boss has given me a project to create a tool for our team (I work in insurance). I'm done with most part of the project, but my boss wants editing and updating of database restricted to a few members of our team (yes more than one person can modify) but since the tool is to be used for a wide range of purposes, she would like that the rest of the department (50+ people) can only access certain forms which have buttons etc. that do the job.
So far in this database I have, 3 linked tables (which hold all the data), queries, reports, union queries and make tables and 3 forms. What I would like is for most people to only view forms and use it in form view only, but 4 members of my team to do whatever they want since they need to constantly edit the data.
Does anyone have a hint about where I should begin? Programming is not my cup of tea so I would really appreciate some reference etc. or any help!
If you hit file, then hit options, and then select current database, you can force a specific form to pop up whenever you open the access database. In addition, you can take away the user's ability to go through the entire database's content. you can also take away the navigation bar and menus and such. I have been doing this for a while, so here's some advice. Have a main menu form that has a button for every form in the access file. When the user opens the database, he or she should see that main menu form. From there, they can click on the button that will lead them to the form that will solve the needs they have.
Stackoverflow won't let me post a comment, so here is what I was going to say. For those who you want to have access to it, you can have them hold shift while opening the database. If they do that, they will open the database like they were an "admin" to the database. They would be able to edit it however they would like if they hold down shift.
I have done this via a table, assigning users a specific "Security Level" and checking their security level via a login screen. I then hide the login screen (not close it) so that anytime a form is open it can do a DLookup of the user's security level and then determine if the user has read, write or read/write access to the form. I can also hide buttons on the form based on the same logic.
Starting in 2007, Access removed their native security, which was pretty inefficient anyway.

Creating a Wizard Interface with MS Access

Does anyone have any pointers on how to go about creating a "wizard interface" using Access 2010? I need a sequential set of forms that will be capable of branching the flow based on answers from the user and data found in the database. I have used Access before for some CRUD/Reports type of applications, but in this case I can't seem to wrap my head around how to get started on such a complex machine.
Before anyone suggests it, I cannot use anything but Access due to client requirements.
I feel your pain ... working with Access gets so difficult where there are complex requirements.
Gather and document the requirements
Make sure you've teased out every possible wrinkle and contingency from the client, and put it into a flow chart or something.
Extract the models
Figure out what models are being used -- customers, addresses, vendors, products, etc. These will have to be created as tables or adapted to existing ones.
Extract other variables
What could potentially change over time and/or what will the client want to be able to change via an admin screen? You'll have to decide which of these variables to put into tables, and which are ok in the code (form logic and/or VBA).
Design the tables for the wizard views
I imagine you'll want a wizard screens table, where each row corresponds to a step; each should have (other than an id column) a previous screen column, and a form name or form template name column. You'll need a second table choices with a many-to-one foreign key linking back to screens; each row here will correspond to a possible outcome of the view, and the target next step in the wizard.
Design the forms
Finally, design the forms corresponding to each wizard step or template, pulling data from the structures in 1-4 as needed.

Queries based on forms and MS Access development

i have 2 questions when i use access:
i create a form with comboBox and calenders, i want to choose an employee
from combobox and from date and to date and when i click ok i will send these
parameters to a query to return the result in a query (result is the calculation
of it's salary).
i know how to release an access project to be useful to user that can't
access tables and queries only forms.
is there any way to change the access project from release mode to development
one, because supposed that an error occurred, how to solve it without loosing
my data.
Note: i don't have client/server i develop a program and i release it and
give this release to the user, after a specific time this user tell me that
an error occurred, and he need data inserted from this program to database.
i can solve this problems and release another version of program, but the
main problem is how to take all data from the old program to the new one.
-- You can reference form control in a query:
SELECT FROM MyTable
WHERE EmployeeID = Forms!MyForm!cboEmployee
AND SomeDate BETWEEN Forms!MyForm!txtDateStart And Forms!MyForm!txtDateEnd
You could also build an SQL string and use it as the record source for a form or in VBA.
-- Access should be split into front-end (forms, reports, etc) and back-end (data). When you make changes to the front-end, you create a new mde or accde and send that to the users. The data stays on a server in the back-end.
See: http://msdn.microsoft.com/en-us/library/aa167840(v=office.11).aspx
EDIT
From your comments, it seems that each application has a single user, if this is the case, splitting is not essential, but it can still be a good idea. The user will get two databases, one for data and one for forms etc and only the one for forms gets replaced. You will need to include a routine to locate and link the back-end tables.
However, if this is not possible, an mde or accde does not hide the data, you can send your revised copy and include a routine to import from the previous mde/accde.
EDIT 2
There are wizards that will split your database for you and link the tables. Where you find them varies slightly from version to version, but they are under the menu item Database Tools. The only problem with this is that the linked table holds the location for the back-end, which is on your computer, not on your users computer. Linked tables are how you access data in the second database. These act as if there are tables in the first database, except you cannot change them. Unfortunately, linked tables hold the location of the back-end, so this will have to be changed if you are sending it to a users. You can either write code, or show your user how to use the linked table manager. This may lead to confusion and may not be worth the effort for one PC. (See also http://www.alvechurchdata.co.uk/accsplit.htm)
Alternatively, you can split the database on your PC and make all the changes to forms etc that you want, then add some code that will import the tables and other data for the user into your new copy. The user will follow the instructions in your code to import the tables. As an aside, you will find that development is a lot safer on a split database. You should also decompile from time to time, which you can find at http://www.granite.ab.ca/access/decompile.htm.
If you want to protect your code, you can create a compiled version of this new copy, the extension for a compiled Access database is *.accde, for 2007 onward and *.mde for prior versions. This is what I thought you meant by 'i know how to release an access project'.

MS Access 2003: Can data disappear from records and how do I test for this and prevent it?

Problem and about the database: Data from a record in Access 2003 database has disappeared. This database has 1 backend and 3 frontends, multiple users and is hosted on Citrix. Within this database, we have records of all clients served, ranging in the 1000s.
Background info: The form for client data entry is set up with various subforms, including both a "programs enrolled" subform and a "services" subform. A client can be enrolled in multiple programs. Once enrolled in a program, services can be entered for that program area using the services subform. There are multiple fields in the services subform, one of which is a drop-down field allowing you to choose from the programs a client has been enrolled in (the list is updated for that client whenever he is enrolled in a new program).
The problem details: For one specific record and one specific program area, the program has disappeared from the "programs enrolled" subform and all of the related services have disappeared from the "services" subform for a period of 3 months of data entry. However, other programs and services for this record did not disappear.
Questions: Is the disappearance of data a common Access 2003 problem? Are there tests in place that can be run to see if data is disappearing and catch that data? If so, what are they? If there is specific code involved, what is it? What can be done to prevent the disappearing of data (other than using a different database)?
As #HansUp says, this is not a common issue. Two things spring to mind:
Jet/ACE files do not like to be stored on file servers with replicated file systems unless the file is edited on only one side of the replication synch. That is, if two servers have a replicated volume and you have people connecting to both servers and trying to edit both copies of the database, you'll hose the data. If you're editing on only one side, there shouldn't be any issues, but I worry about this kind of thing. Another issue might be virtualization, though I don't have any definite scenario where that could be a problem.
More than 10 years ago I saw an issue that combined the old bookmark bug with On Error Resume Next that caused data to not be saved. What was happening was that turning off error reporting/handling with the On Error Resume Next was not properly going out of scope, and errors that were occuring in the departure from a record via bookmark navigation were never being reported. The result was that edits were lost. When I changed the bookmark navigation to save the record if it was dirty before changing the bookmark pointer, the problem went away. But while I was at it, I eliminated as many On Error Resume Next statements as possible.
Another guise of the second problem would be if DoCmd.SetWarnings is set to False. I never bother with SetWarnings, so it's not an issue, but it's a common novice technique, and worth looking at. The idea is that errors are happening but the report of them is not getting to the users, and thus, the edits are being lost.
I don't consider either of these very likely, but your situation is so uncommon that even unusual things like these are worth looking at.
Is the disappearance of data a common Access 2003 problem?
No. Data in any version of Access does not just disappear without cause. Unless perhaps your database file has been corrupted. More likely you have a design error in your form and/or database schema.
If you have a form/subform based on parent and child tables, make sure you have a relationship established and that you enforce referential integrity on that relationship. That is a standard practice to ensure you can't delete a parent record while you still have at least one related record in the child table.
Based on your description, it's not clear whether the data is missing from your data tables or just not appearing in your subform when you expect to see it. You might want to clarify that point.
At this point, we have determined that the missing data occurs at random and is not traceable to a specific pattern which makes it rather difficult to pinpoint a solution. We are still uncertain if the data actually disappeared or if the user assumed he had entered the data but had not. Unfortunately, our db host does not keep a series of backups that we could trace back to, but rather updates the backup at the end of each day--again raising a problem for tracing the disappearance. We will continue to investigate the various answers provided here and are grateful for your great input and suggestions.