application.currentproject -- I want a remote project

Access9001

Registered User.
Local time
Today, 11:21
Joined
Feb 18, 2010
Messages
268
I can use application.currentproject for the current project but I want to refer to a different project so I can use .allforms

How would I do this?
 
You can use

Code:
Dim appAcc As Access.Application

Set appAcc = New Access.Application

appAcc.OpenCurrentDatabase("YourFileAndPathHere")

appAcc.CurrentProject.AllForms....etc.
Not clear what you wanted the All Forms part for but there you go and if you want to keep it open when the other database you are in closes you would use

Code:
appAcc.UserControl = True
so when you close this one, that one remains open.
 
It says I keep referring to an object that is closed or doesn't exist even when the path is correct for "YourPathandFilehere"
 
It says I keep referring to an object that is closed or doesn't exist even when the path is correct for "YourPathandFilehere"

What is the ACTUAL path and name of file you are trying to use in the code?
 
I understand -- I am using the real path

Dim appAcc As Access.Application
Set appAcc = New Access.Application
Dim pathway As String

pathway = "\\rootblahblah\source.mdb"

appAcc.OpenCurrentDatabase (pathway)
 
I understand -- I am using the real path

Dim appAcc As Access.Application
Set appAcc = New Access.Application
Dim pathway As String

pathway = "\\rootblahblah\source.mdb"

appAcc.OpenCurrentDatabase (pathway)
It looks like your pathway is missing something. It has a server name of rootblahblah (I doubt that is real) and you have specified no share.

You normally have to include the server and share:

\\ServerNameHere\ShareHere

and then the file could be in that share folder but then if it is down further it would need the file folder too

"\\ServerNameHere\ShareHere\FolderHere\source.mdb"
 
I do have that, I was just not posting the full thing for security purposes. But I've used plenty of paths before and I know the one I have is legitimate and fine.
 
"\\ServerNameHere\ShareHere\FolderHere\source. mdb"
There seems to be a space prior to the .mdb is this AWF doing or a typo?

Have you tried dir(\\...) ?
 
AWF is probably adding the space to prevent spam.

teeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeest
 
I do have that, I was just not posting the full thing for security purposes. But I've used plenty of paths before and I know the one I have is legitimate and fine.

And we would know that HOW?

Anyway, the path should be fine then but what are you trying to do with AllForms? I just tested on my machine and got the same exact error if I tried to do something for something that didn't exist or wasn't open.
 
If appAcc.CurrentProject.AllForms("Form1").IsLoaded Then
MsgBox "OPEN"
Else
MsgBox "CLOSED"
End If
 
If appAcc.CurrentProject.AllForms("Form1").IsLoaded Then
MsgBox "OPEN"
Else
MsgBox "CLOSED"
End If

Okay, two things here. You appear to be wanting to check to see if someone has something open in another database. When you use the code I gave you, you are instantiating a NEW instance of that so NOTHING will be open at that point.

As far as I know there is no way to do what you are really wanting.
 
In a multi user environment how are you going to test if a form is open? One person may have it open whereas another person may not. As each user will - or should have their own copy open on their machine not a shared machine - If opening on a shared location then this is wrong.

What is the object of the exercise? and what are you hoping to acheive?
 
Trying to make an automatic log of databases that crash upon load. Certain db's have forms that load on startup. I am trying to basically make a db that opens all other db's and checks to see if the proper form actually loads. If not, log it as an error.
 
You should be resolving the error not managing it
 
You might want to have a table and in the form's ERROR event log the error there.
 
The problem is that the types of errors I wish to log are not necessarily form-derived. Some errors with respect to database corruption arise before any forms are even loaded. These are the types of errors I need to catch either beforehand or during the automation so that they do not hold up other timesensitive processes. But I have yet to find any good way to check for database corruption. So far I have tried finding a way, through VBA, to either edit the registry for the Disabled Items list or by manipulating it directly in order to simply suppress the error. Otherwise it's checking for forms that SHOULD be running but aren't for whatever reason.
 
What errors are you getting?
Are they consistant?
Is the automation causing the error?
Are any trappable?
Is the sequence of events causing the problems?


Errors come in 3 categories

1. Syntax errors
2. Programming errors
3. Logical errors

Which one(s) are you encountering?
 

Users who are viewing this thread

Back
Top Bottom