quote:GeoffS wrote:
You will need to change the Access Library in your Project References to "Microsft Access 10.0 Object Library"
Thank you for your help but when i did my try in access 2002 I also set the right library but i'm still having the problem!!
If you have any other suggestion ... thanks
Clod
20-10-2004 at 07:42 AM
|
GeoffS Level: VB Lord Registered: 29-09-2004 Posts: 536
Re: Help! Calling an Access 2002 Report with vb6
Try this Code :-
I have assumed that you have the Access Project in the same folder as the App so I have retrieved the path for the app first, rather than hard-coding a path.
Dim AcApp As Access.Application
Set AcApp = New Access.Application
Dim strPath As String
'don't forget to dispose of the object when you close the form you are calling from, _
'otherwise repeated calls will end up with loads of instances of MSAccess running on your PC
AcApp.Quit
Set AcApp = Nothing
If your Access is not an adp project but a standard "mdb" database then replace the open call with -
"AcApp.OpenCurrentDatabase strPath"
____________________________ multi-tasking - the ability to hang more than one app. at the same time.
I am trying to call an Access '97 report from VB 6. How would I go about doing that? I have tried several sites and I can't seem to find anyone who can answer this question for me.
22-11-2004 at 04:36 PM
|
GeoffS Level: VB Lord Registered: 29-09-2004 Posts: 536
Re: Help! Calling an Access 2002 Report with vb6
Hi,
Just follow the advice above, but you will need to change the Access Library in your Project References to "Microsoft Access 8.0 Object Library"
You obviously also need to have a copy of MS Access installed on the machine on which you are running your app.
____________________________ multi-tasking - the ability to hang more than one app. at the same time.
I added the correct reference, my database gets opened in the form load, but the code doesn't work and I'm getting this error message:
Run-time error '2486':
You can't carry out this action at the present time. @You tried to run a macro or used the DoCmd object in Visual Basic to carry out an action. However, Microsoft Access is performing another activity that prevents this action from being carried out now.
For example, no actions on a form can be carried out while Microsoft Access repainting a control or calculating an expression.@Carry out the action later.@1@@1
22-11-2004 at 06:09 PM
|
nick2k4000 Level: Big Cheese Registered: 29-09-2003 Posts: 20
Re: Help! Calling an Access 2002 Report with vb6
quote:GeoffS wrote:
Try this Code :-
I have assumed that you have the Access Project in the same folder as the App so I have retrieved the path for the app first, rather than hard-coding a path.
Dim AcApp As Access.Application
Set AcApp = New Access.Application
Dim strPath As String
'don't forget to dispose of the object when you close the form you are calling from, _
'otherwise repeated calls will end up with loads of instances of MSAccess running on your PC
AcApp.Quit
Set AcApp = Nothing
If your Access is not an adp project but a standard "mdb" database then replace the open call with -
"AcApp.OpenCurrentDatabase strPath"
This seems to work, but how do I handle it when there is a password on the database?
17-12-2004 at 07:28 PM
|
GeoffS Level: VB Lord Registered: 29-09-2004 Posts: 536
Re: Help! Calling an Access 2002 Report with vb6
Ah - Now that starts to get a bit awkward when the Database itself has a password on it. As far as I know there is no way to pass the password as a parameter when calling the open command. ( If I am wrong PLEASE someone tell me how to do it!!)
In the past I have used a SendKeys command after calling Open, and that has worked. Don't forget to include "~" at the end of the password for the "Enter" key.
____________________________ multi-tasking - the ability to hang more than one app. at the same time.