Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error and locking when opening report from another database 1

Status
Not open for further replies.

tontenn

Vendor
Dec 29, 2006
54
AU
Hi Guys

Just a quick error question I hope someone can help me with.

In thread702-1332179 I asked a question about opening up a report from another database on the same server. Remou answered and supplied me with a great piece of code that has done the trick. Up until now.

Now when we try to click on the link and open the report on the other database it opens it up ok but then throws up an error message which says

"Run-time error 2455" You entered an expression that has an invalid reference to the property Visible.

It then allows me to debug or cancel but leaves the opened database in lock mode and all we can do is go to task manager and close it from there. Very annoying but also means we cant get to the report we need.

Hope someone understands the issue and has a suggestion.

Cheers in advance

Tones
 
What is YOUR actual code and which line is highlighted when in debug mode ?

Hope This Helps, PH.
FAQ219-2884 or FAQ181-2886
 
Hi PHV

This is the actual code

Private Sub Label129_Click()
Dim strDB
Dim appAccess As Access.Application
' Initialize string to database path.
strDB = "\\Server\common\CSC\Contact Management\CSCContactManagementSystem.mdb"
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB
' Open report.
appAccess.DoCmd.OpenReport "PersonnelList", acViewPreview
appAccess.Visible = True
appAccess.UserControl = True
End Sub

and this is the line highlighted in yellow

appAccess.Visible = True

Hope that helps

Cheers
Tones
 
What happens with this ?
Private Sub Label129_Click()
Dim strDB As String
Dim appAccess As Access.Application
' Initialize string to database path.
strDB = "\\Server\common\CSC\Contact Management\CSCContactManagementSystem.mdb"
' Create new instance of Microsoft Access.
Set appAccess = CreateObject("Access.Application")
[!]appAccess.Visible = True
appAccess.UserControl = True[/!]
' Open database in Microsoft Access window.
appAccess.OpenCurrentDatabase strDB
' Open report.
appAccess.DoCmd.OpenReport "PersonnelList", acViewPreview
Set appAccess = Nothing
End Sub

Hope This Helps, PH.
FAQ219-2884 or FAQ181-2886
 
Hi PHV

When adding this code it still comes up with the error message and the same line of code is highlighted to be debugged.

The only thing it does do is unfreeze the opened database which wasnt happening before so there is a small success, but unfortunately still wont allow us to see the report shoe up automatically.

Thanks good try.

Tones
 
unfreeze the opened database
Your above post implies that the error raises BEFORE the opening of the DB, so I'm confused.
 
Hi PHV

The error message pops up on the screen just after the other databse is opened and when you go to cancel the error message, in the previous version the database was locked and couldnt be shut down. Now at least it can be shut down via normal methods but it still will not allow us to view the report wanted.

Hope that clears it up

Tones
 
Again, which line of code is highlighted when clicking debug (instead of cancel) ?
 
The line of code highlighted when you hit debug is

appAccess.Visible = True
 
Well, this line is BEFORE the appAccess.OpenCurrentDatabase call, and thus I'm still confused.
 
Yeah its very weird.

And I have found it is not happening on some machines but it is on mine and a couple of others. It may be individual machine or software issues

But thanks for your help
 
What happens if you open normally the shared CSCContactManagementSystem.mdb from your machine ?

Hope This Helps, PH.
FAQ219-2884 or FAQ181-2886
 
When i open it it normally it opens straight up and then I just choose the report and off I go with no errors what so ever.

The only thing that does still come up is some stupid microsoft conditons box which I have to accept before I can see the database.
 
Which sort of conditions box ?
Seems like a security level issue ...

Hope This Helps, PH.
FAQ219-2884 or FAQ181-2886
 
You may try this:
...
Application.AutomationSecurity = 1 ' msoAutomationSecurityLow
Set appAccess = CreateObject("Access.Application")
appAccess.AutomationSecurity = 1
appAccess.Visible = True
appAccess.UserControl = True
appAccess.OpenCurrentDatabase strDB
...

Hope This Helps, PH.
FAQ219-2884 or FAQ181-2886
 
Hi PHV

The conditions box is titled "Microsoft Office End-User Licence Agreement" and it has lots of conditions to scroll through and then at the bottom 3 buttons Print Accept and decline.
Every time, whether in this situation or just opening Access it comes up and says if I dont press accept the program will quit.

No i pasted the last code you sent me into the area which i thought it was supposed to go but it made no difference and still came up with the same error.

Is there a way of getting rid of the conditions box??
 
Did you register your ms-office version ?
You may consider to repair your ms-office install.

Hope This Helps, PH.
FAQ219-2884 or FAQ181-2886
 
Hi PHV

yeah we have checked that and all our copies are registered and have actually all been reinstalled just recently and it still occurs on a few machines.

Must be an error with the software, I might try microsoft and see if there are any solutions there, thanks for your time
 
have actually all been reinstalled just recently
With all office update patches applied ?

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top