open another database from with in current database

murray83

Games Collector
Local time
Today, 21:13
Joined
Mar 31, 2017
Messages
828
this is the code which works just great

Code:
'to open the Inbound Scheduler
Private Sub cmdGIS_Click()

Dim accapp As Access.Application
 
Set accapp = New Access.Application
 
accapp.OpenCurrentDatabase ("G:\GENERAL\Databases\GIS\App\Inbound Scheduler v1.05.accdb")
accapp.Visible = True

End Sub

but there is one thing. When the release a new update the file gets incremented so we have a script which then makes the file location look like this

Code:
G:\GENERAL\Databases\LDS\open LDS-LIVE.wsf

this how ever does not open the database, is this due to it being a script ??? or do i need to change the last line
 
A windows script file is executed. Try

intX =Shell("G:\GENERAL\Databases\LDS\LDS-LIVE.wsf")

where intX is declared an integer
 
so would it look like this

Code:
'to open the Inbound Scheduler
Private Sub cmdGIS_Click()

Dim intX As integer

Dim accapp As Access.Application
 
Set accapp = New Access.Application
 
accapp.OpenCurrentDatabase intX =Shell("G:\GENERAL\Databases\LDS\LDS-LIVE.wsf")

accapp.Visible = True

End Sub
 
That would give a compile error placing two statements on one line.

I assume the script file replaces the the old with the updated version. The line below (by itself) runs the script
intX =Shell("G:\GENERAL\Databases\LDS\open LDS-LIVE.wsf")

Then you open the database on the next line with
accapp.OpenCurrentDatabase ..........
 
That would give a compile error placing two statements on one line.

I assume the script file replaces the the old with the updated version. The line below (by itself) runs the script
intX =Shell("G:\GENERAL\Databases\LDS\open LDS-LIVE.wsf")

Then you open the database on the next line with
accapp.OpenCurrentDatabase ..........


yeah the script does exact which you assumed, i shall try that later and let you know the outcome
 
tried as suggested but perhaps missing something as have got the attached error
 

Attachments

  • error.png
    error.png
    29.8 KB · Views: 330
You are missing the Dim statement.

Dim intX as Integer
 
Dim was there in #3

Gone AWOL :-)
 

Attachments

  • debug.png
    debug.png
    8.7 KB · Views: 307
  • in sub.png
    in sub.png
    7.9 KB · Views: 318
If your script file is only updating the database file, why not just use vba commands

Kill "G:\GENERAL\Databases\GIS\App\Inbound Scheduler v1.05.accdb" ' Delete old file

FileCopy strPathNameSourceFile, "G:\GENERAL\Databases\GIS\App\Inbound Scheduler v1.05.accdb" 'copy in new file
 
ok think i may have confused the issue slightly

the script is used to open the database, as the back end and the UI have been split it doesnt update the database, when a new release is launched the script text is changed for the new version i.e from 1.1 to 1.2 thats all
 

Users who are viewing this thread

Back
Top Bottom