Creating a working copy of an old Access 2010 database - vba

I am tasked with fixing some bugs that an access 2010 database, written 10 or so years ago, has. The database has been functioning but has a few bugs in report generation that need to be fixed (ie: bugs are not impeding overall functionality).
Since I am relatively new to access 2010, I wanted to create a working copy of the entire database, VBA and all, so that I could get into the VBA code and figure out what is causing the bugs without accidentally sending some of the automatic emails or changing pertinent information in the data. I have tried saving the database with a new name, copying it in the folder and pasting elsewhere, and creating a backup and saving that elsewhere.
Each attempt yields the same issue: the VBA project not being readable. It gives the following message when I open any copy:
if included picture doesn't load: tl/dr: database cant be opened because VBA project cant be read, if "ok" is clicked vba project will be deleted..I have searched high and low, asked everyone that has used the database, nobody knows how to fix the issue and I do not feel comfortable changing anything in the live copy.
Any assistance would be greatly appreciated. Thank you in advance.

One option you might try is to create a new blank database file and attempt to import all of the database objects from a copy of your target database into the new database file using the import wizard. If that's successful it won't be an exact replica of the previous database with regards to settings, but will include all of the database objects/code at least.

Related

SSAS Tabular How to Change the connection of a table

I created a Tabular model using VS 2013 (because later versions don't support BIDS helper (which we use for creating a folder structure organizing all measures and dimensions within the model)). After working on it for a while I noticed that I was missing a table, so I went back to go get it. The only mistake which I made was that I ended up creating a new data connection in the process. Short of dropping those tables and recreating them, is there a simple way for me to change the data source of that new table so that I can delete the redundant connection to my database?
A colleague shared the following link: http://jakubka.blogspot.com/2013/11/how-to-change-connection-string-for.html.
While changing the code in this way most certainly comes across as being hacky and is probably not the highly recommended way to do things; it worked! Took me less than 5 minutes to fix and it was as simple as described in the link...
Jakub K (author of the article), thanks, man!
I encountered this issue today. I have VS 2017 and co-worker showed me how to do this.
Create New Data source in the Model(.bim file)
Save and close .bim file
Right click the .bim file and view code . This gives you an editable view.
Edit the connection on all the tables you want changed, not the original connection.
Save and exist .bim file
Open .bim file and confirm change.
In this case I use Tabular Editor.
There is a good article about it Tabular Editor Tricks - Convert to Legacy

Create a copy of a file with Visual Studio 2012

I am sorry for the bad heading, but no better came to my mind.
I am creating a program (vb.net) with a database. When I build the program the database is already in and the program is working.
If the user of the build, uses and edits the database, the changes are saved. But if I update the program the database will be overwritten and all the changes of the user are gone.
I'm searching for a solution since hours, but I can't find good keywords for searching. So maybe someone can help me.
My idea is to copy the database from the program, which is saved here:
C:\Users\<Username>\AppData\Local\Apps\2.0\XB8ZOKH5.AK0\C9NZMRPR.25M
to a permanent storage place, e.g. here:
C:\Users\<Username>\program\database.accdb
How can I do this with Visual studio?
You are on the right track. I learned a similar technique, years ago and it has worked well for small projects like yours.
Your installer should only install a "template" version of your database on the hard drive.
When your program starts up, it can try to connect to the "working copy" of the database. If the user cannot connect to the database, or there is no setting for the "working copy", the program can make a copy of the "template" (System.IO.File.Copy) and save a setting, pointing to the "working copy". Then each time the program is upgraded, your full database will be safe. Of course, it is also a good idea to have your program make a "backup" of the database (zip) often.

Access is not showing the records I have entered through vb.net form

I am new in vb.net programming. Am facing a problem in database handling. Am using oledb to deal with database, which is MS Access in my project. I am dealing with queries at the time. Now the problem is that my queries are working well on vb form but are not affecting the actual database. For example, when am adding a record, it displays 'record added successfully', the message I have used for my conformation, but the actual database is not displaying the record I just entered and even got the above conformation message as well. I have checked query in sql editor too, its doing well. I have checked locals in vb debug mode, all are containing correct values.
Am not getting what's the reason behind that. Why it is displaying the success message but not modifying the actual database. Same is the case when am firing delete query, till now. I have not tried Update query yet.
Technology - Visual Basic.net with MS Access
Am using Access 2007 and Visual Studio 2013
Please Help by your suggestions
Do the controls on your form have the correct control source, i.e. the database table/query from and to which it should be reading and writing to?
Basically the problem was the gap between my understanding and .Net's working.
Here is the solution.
You can include database in two ways:
1.Either importing it directly to your project from the place, for example using drag and drop, or some other such method.
2.Or, by including it via using wizard.
But, the difference lies in connection string you use in your project, if you give absolute path of database, then you will directly see the alterations in database you have done using your application, even in testing and debugging mode via IDE.
connection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\xyz.accdb"
But if you are using connection string provide by wizard, for example,
connection.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=|DataDirectory|\xyz.accdb"
what the IDE will be doing is whenever you will be running project for debugging or testing, every time, it will copy the actual database, with its contents as well, in /bin/Debug folder. So, the changes you are performing will only be visible to that copy, not the actual file. So, if you want to verify with the database, like in our case, check the copy of database, which will be present in /bin/Debug folder. You will see the changes there. But, every time you run project for debugging, it will replace that copy with original one.
So, actually I was checking the original database file, not that copy, since the changes were only made to that copy. So that is why I was facing the above problem, not due to any programming fault.

MS Access error on opening database

I work with Access daily, and this situation is unlike anything I've ever seen Access do:
I created a database tool in Access for a report I run at work. The other day I was using it, and Access abruptly closed itself down. I went to reopen the tool, and I got an error saying "Microsoft Access has stopped working. A problem has caused the program to stop working correctly. Windows will close the program and notify you when a solution is available."
A few minutes later it prompts me to create a backup, which also does the same thing when I try to open it...
...unless...
I open Access itself and search for the original tool. Then it opens just fine.
I have tried repairing this database, and nothing works. It simply won't let me open this tool unless I go through Access first.
Does anyone have any ideas on this? What gives???
(Windows 7 Enterprise Edition, MS Access 2007)
A few things I would try
1) Create an entirely new DB, and import all of the objects from the problematic database. Any corrupt objects will show as an error during that process. You may get lucky and the new DB can simply be the new production DB.
2) Hold down the Shift key as Access is loading to bypass any startup code.
The problem is likely in the VBA link, which the new DB shell will fix.

How do I edit an Access ADP file?

So I have this Access Database Project file that I have been tasked to edit. I have Access 2003 and 2007 installed. The ADP only supports 2003 for some reason. Anyway, the issue I have is that I can't figure out how to get to the VBA code in behind things.
The previous developers have done a very good job of locking everything down on the GUI such that the only thing I get when I open the application is a notice saying that it can't find the database on the server. (More than likely there is a problem there too, but since I can't look at code I don't know for sure.)
Does anyone know how to get around the GUI lockdown that has gone on here?
Michael
As it turns out, you can edit an ADP file that has all of the form information turned off by finding the file using Windows Explorer by highlighting the file, then hold shift, and then hit enter. You continue to hold shift until the interface is loaded.