bfuchs
asked on
How to make an ADE file by code?
Hi Experts,
Wondering if there is a way to have a button in my app that does the following.
Makes a copy of the current file, then saves that file as an executable (ADE in my case), or perhaps that could be done without making a copy.
The purpose of this is to save the time I have to wait when doing it manually, so this can be running in background while I continue working on my app.
Wondering if there is a way to have a button in my app that does the following.
Makes a copy of the current file, then saves that file as an executable (ADE in my case), or perhaps that could be done without making a copy.
The purpose of this is to save the time I have to wait when doing it manually, so this can be running in background while I continue working on my app.
ASKER
Hi Jim,
However this is also part of the question, if its safe to make a copy of a file while its being used?
Also what exactly can go wrong, I will get an error msg or it will run smoothly and users will later realize problems?
Thanks,
Ben
Not really for the app that your currently in, But you could write code to do it against another db.Yes, this was my assumption and therefore I started with the option of copying the file first and doing it to the copy.
However this is also part of the question, if its safe to make a copy of a file while its being used?
Too many things can go wrong with in creating a accedeHow about an ADP to an ADE?
Also what exactly can go wrong, I will get an error msg or it will run smoothly and users will later realize problems?
Thanks,
Ben
Are you making an ade from and add? or did you mean accde?
Regardless, I don't understand the issue. There's no need to make a copy of your current database. Depending on which version of Access you are using, it's either on the menu or under the File, Publish options. It always creates the ade in a new file name and doesn't modify the source database.
Regardless, I don't understand the issue. There's no need to make a copy of your current database. Depending on which version of Access you are using, it's either on the menu or under the File, Publish options. It always creates the ade in a new file name and doesn't modify the source database.
ASKER
@Luke,
See OP
Thanks,
Ben
an ade from and add? or did you mean accde?No, this is an Access ADP project connected to SQL Server 2005 BE. the file (stripped out the code how Jim calls it) has .ADE extension.
See OP
The purpose of this is to save the time I have to wait when doing it manually, so this can be running in background while I continue working on my appFYI- this is quite large app and it takes a while to compile and save, and since I'm constantly doing it after each app change so users can test it, therefore I'm looking to do it via code in the background..
Thanks,
Ben
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Jim,
Due to some power outage I got delayed with the response..
Will test it later & let you know.
Thanks,
Ben
Due to some power outage I got delayed with the response..
Will test it later & let you know.
Thanks,
Ben
ASKER
Hi,
OK so far I was able to do so from another file using one of the suggestions mentioned there, however when trying to copy the file itself while its open I get attached error..
Below is the code.
Thanks,
Ben
untitled.png
OK so far I was able to do so from another file using one of the suggestions mentioned there, however when trying to copy the file itself while its open I get attached error..
Below is the code.
Public Sub MakeADE()
Dim accApp As Access.Application
Dim strPathOrigADP As String, strPathSourceADP As String, strPathDestinationADE As String
strPathOrigADP = Application.CurrentProject.FullName
strPathSourceADP = Replace(strPathOrigADP, ".ADP", "2.ADP")
strPathDestinationADE = Replace(strPathSourceADP, "2.ADP", ".ADE")
Set accApp = New Access.Application
If Dir(strPathSourceADP) <> "" Then Kill strPathSourceADP
FileCopy strPathOrigADP, strPathSourceADP
accApp.SysCmd 603, strPathSourceADP, strPathDestinationADE
Set accApp = Nothing
End Sub
Thanks,
Ben
untitled.png
The other DB cannot be opened in exclusive mode. It must be in shared mode.
Jim.
Jim.
ASKER
Hi,
The reason I'm looking to impliment this is that I can create an ADE while continuing working at the file (programming changes).
While if I open in shared mode, changes cannot be made to the file (I guess).
P.S. I also tried that syscmd directly w/o copying the file and didnt work either.
So far I'm stuck here, unless I try the other suggestions perhaps will have better luck..
Thanks,
Ben
The reason I'm looking to impliment this is that I can create an ADE while continuing working at the file (programming changes).
While if I open in shared mode, changes cannot be made to the file (I guess).
P.S. I also tried that syscmd directly w/o copying the file and didnt work either.
So far I'm stuck here, unless I try the other suggestions perhaps will have better luck..
Thanks,
Ben
Ben,
<<So far I'm stuck here, unless I try the other suggestions perhaps will have better luck..>>
As I said at the start, trying to automate the process is problematic for a number of reasons and most give up on it.
You'll need to write the above as a small utility app, execute that, then start another of instance of Access and continue working on the original file while the other works on creating the accde against the copy.
Jim.
<<So far I'm stuck here, unless I try the other suggestions perhaps will have better luck..>>
As I said at the start, trying to automate the process is problematic for a number of reasons and most give up on it.
You'll need to write the above as a small utility app, execute that, then start another of instance of Access and continue working on the original file while the other works on creating the accde against the copy.
Jim.
ASKER
Thanks
However with that said, People usually don't have much luck with this. Too many things can go wrong with in creating a accede. And that's not really an executable by the way. A accde is nothing more than a accdb with the source code stripped out.
Jim