View Full Version : VBA Code doesn't work
brejackson
Sep 10, 2011, 07:45 AM
For Scott Gem: OK, one more question, Brenda, before I can take a look at this.
Do you have any code that automatically relinks the back end from the front end? If not, what is the path to the back end. To test this I will need to recreate that.
Also, can you post that info on askmehelpdesk. We can then continue the support there.
Answer to your question: There's no code to relink the back end from the front end. Below are the paths for all the files I sent you.
Backend - C://Documents and Settings/Brenda Jackson/My Documents/Backend Copy of OrigCopy of ProInvoice Trend_be_accdb
Frontend - C://Documents and Settings/Brenda Jackson/My Documents/Frontend Copy of OrigCopy of ProInvoice Trend.accde
OrigCopy - C://Documents and Settings/Brenda Jackson/My Documents/Backend Copy of OrigCopy of ProInvoice Trend.accdb
ScottGem
Sep 10, 2011, 03:29 PM
Hi Brenda,
OK, I see what's going on here. I'm not sure where you got the code behind all the buttons on your main form, but they will NOT work as an ACCDE. You are trying to modify a form on the fly and you can't do that in an ACCDE because Design Mode is not available.
That code is very complex, so I suspect that you found it someplace and adapted it. Why you aren't using Bound forms and eliminating all that code I don't quite understand. It would take me a while to analyze the code and try to understand what you are doing. Maybe some explanations would help me help you. But if you want to deploy as an ACCDE you will need to recreate all your forms.
As for the change password form. There was no code to open the main menu after the password was changed. Once I added that, it worked fine.
brejackson
Sep 10, 2011, 04:46 PM
This way over my head. The person who wrote the code is no longer available. I need the database to give the results that is currently giving in each form.
How do I create other forms that will give me the same results? Help, please. I'm running out of time on this project and have to get it up and running by month-end. Thanks so much for all your help thus far.
ScottGem
Sep 10, 2011, 04:50 PM
Ok, you need to explain to me in greater detail what this app does and what the forms are supposed to do. I can't promise anything as this goes way behind the scope of a help site.
But you can distribute it as an accdb and it should work. But to distribute as an accde would require a rewrite.
brejackson
Sep 10, 2011, 05:06 PM
The app is designed to give previous month, 3 month, 6 month, 9 month and yearly trends. It's for read only by the user and the admin will update each trend once a month. Each command button displays the trend results in form view.
If I distribute as accdb will this allow changes and updates to be made by users? This not what I want to happen.
ScottGem
Sep 10, 2011, 05:28 PM
Ok, Here's what I would do. The first thing to try is to set the network permissions on the backend file to read only. Each user still needs read/write permissions to the folder the back end is in, but you can set read only on the file.
If that works then you can distribute as an accdb with no problem.
If that doesn't work, then the next thing is to try and set the forms to not allow edits. I'd have to look over the code and see if I can figure out where to do that.
The next option beyond that is a rewrite.
brejackson
Sep 11, 2011, 05:41 PM
Are you saying set the file to read only on the back-end (where all the tables are located and no queries/ forms are in this file) and make the network folder read/write? If so, I tried that and problem I see with that is the user can change the settings back.
My question now is do I rename the accde to a accdb so that the linked tables will work and the forms will give the results as the command buttons are clicked? Will I be able to distribute the accdb to each user to run on their desktop? I'm totally at a lost here.
ScottGem
Sep 11, 2011, 05:49 PM
What type of network setup? If this is server based network, then users should not be able to set permissions on network shares. So they should not be able to change those permissions. But why would users try to do so? I assume this is corporate data and users should know better then to change such data.
No you don't rename the accde. You need to split the accdb and LEAVE it split. You distribute the front end accdb. And yes you would then distribute a copy to each user.
You can use a tool like AutoFEUpdater to make sure the front end is kept up to date.
brejackson
Sep 12, 2011, 05:22 AM
I misunderstood what you wanted me to try. Instead of splitting the database again I made the current back-end read only.
Question, before I split the database am I to make it read only and then split it?
ScottGem
Sep 12, 2011, 07:37 AM
The back end is what should be read only. The back end should be stored on a network share. Once split, you should STOP using an unsplit version. Otherwise you have to split it each time before you deploy and that makes no sense. Since you can't distribute a front end as an ACCDE using the existing code, there is no reason to maintain the ACCDE. So you should just store the back end on your network share, making sure the front end is linked to it. Since this front end will not be making any changes to the back end, there is no need for a test back end.
So use the splitter storing the back end on the network share. Then set network permissions on the file level to read only and test the front end. (BTW, you can hid the Nav Pane under Access options you don't want it to show at all.
brejackson
Sep 12, 2011, 10:47 AM
Your response: So you should just store the back end on your network share, making sure the front end is linked to it. Since this front end will not be making any changes to the back end, there is no need for a test back end.
How will all the form design view be protected on the front end since none of this on the back end?
As I had mentioned the database is updated once a month (the invoice table for each trend) When the form is generated it also updates the amount and volume form for each tables,which updates the queries.
Will the users see the updates on their desktop based on the way you asking me to try?
ScottGem
Sep 12, 2011, 02:44 PM
I'm assuming the invoice tables are updated by a different process. When the users open their front end it will connect to the back end. When they click a button on the menu, the forms will be recreated with whatever updates the code performs.
If the users monkey with the code behind the forms they will not get the correct data. So why would they?
So yes, what I'm suggesting should do what you need.
brejackson
Sep 22, 2011, 05:03 PM
Scott, I've taken your advice and distributed the app as an accdb. Now, I have another problem. The user was given the front end (accdb) and the backend(be) is in the network share folder. When the user tries to open the app the following error message appears:
Workgroup Administrator couldn't create the workgroup information file. Make sure that you have specified a valid path and file name, that you have adequate permissions to create the file, and that you have enough disk space on the destination drive. (-1201) What is this? Does Access 2007 have Workgroup Administrator?
ScottGem
Sep 22, 2011, 05:43 PM
Is the backend an MDB? Are they accessing the app through a shortcut? Maybe the shortcut is still trying to load an MDW.
brejackson
Sep 23, 2011, 04:24 AM
Your Question: Is the backend an MDB? Are they accessing the app through a shortcut? Maybe the shortcut is still trying to load an MDW
The backend is accdb. They are accessing through a shortcut.
This is what I did:
1. I placed the backend (be_accdb) in the network folder
2. Sent the accdb to the user in a zip file
3. Had the user to unzip it to their local drive
4. Open the zip and create a shortcut to their desktop
5. Run the app
ScottGem
Sep 23, 2011, 04:32 AM
Hmm, That shouldn't be happening then. Have the user try to run the app by directly opening the accdb. Or by opening Access and selecting the accdb.
Also what versions of Office does the user have?
brejackson
Sep 23, 2011, 02:43 PM
Thanks Scott for your help. The problem was with the Trust Location set up on the users machine. Again thank you for all your time and patience. I really appreciate everything you've done. I think I can put this one to rest now. Thank you.
ScottGem
Sep 23, 2011, 04:28 PM
Glad to hear it.