|
Next: How to delete all files beginning with ... ?
|
| Author |
Message |
External

Since: Feb 08, 2005 Posts: 25
|
(Msg. 1) Posted: Mon Feb 14, 2005 11:40 pm
Post subject: How do I run a report in Access from Visual Basic? Archived from groups: microsoft>public>vb>database>ado (more info?)
|
|
|
I have a report written in Access that is now working pretty well and
I would like to include it in the VB application that uses the Access
database that the report is in.
I have used VB to build the tables the report is based on and I would
like to let the user click a button to run the report.
Can I just use my ADO connection to run the report? If not, how can I
open Access and run the report via my program code?
Thanks
Greg Teets
Cincinnati Ohio USA >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 04, 2004 Posts: 123
|
(Msg. 2) Posted: Tue Feb 15, 2005 12:25 am
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
You need to use Access Automation:
Something like:
Dim objAccess as Access.Application
Set objAccess = New Access.Application
objAccess.OpenCurrentDatabase "C:\MyDB.mdb"
objAccess.DoCmd.OpenReport "YourReport", acViewPreview
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--
"Greg Teets" <gteets99.TakeThisOut@yahoo.com> wrote in message
news:bfq2115tdbnlbp10m735cmh4bfcqup2qj4@4ax.com...
> I have a report written in Access that is now working pretty well and
> I would like to include it in the VB application that uses the Access
> database that the report is in.
>
> I have used VB to build the tables the report is based on and I would
> like to let the user click a button to run the report.
>
> Can I just use my ADO connection to run the report? If not, how can I
> open Access and run the report via my program code?
>
> Thanks
> Greg Teets
> Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 04, 2004 Posts: 123
|
(Msg. 3) Posted: Tue Feb 15, 2005 12:27 am
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Should have added the each user of your application would require a licensed
version of Access on their system..
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--
"Veign" <NOSPAMinveign DeleteThis @veign.com> wrote in message
news:OpoLCcxEFHA.624@TK2MSFTNGP09.phx.gbl...
> You need to use Access Automation:
>
> Something like:
> Dim objAccess as Access.Application
> Set objAccess = New Access.Application
>
> objAccess.OpenCurrentDatabase "C:\MyDB.mdb"
> objAccess.DoCmd.OpenReport "YourReport", acViewPreview
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
<font color=purple> > <a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp</font" target="_blank">http://www.veign.com/vrc_main.asp</font</a>>
> --
>
> "Greg Teets" <gteets99 DeleteThis @yahoo.com> wrote in message
> news:bfq2115tdbnlbp10m735cmh4bfcqup2qj4@4ax.com...
> > I have a report written in Access that is now working pretty well and
> > I would like to include it in the VB application that uses the Access
> > database that the report is in.
> >
> > I have used VB to build the tables the report is based on and I would
> > like to let the user click a button to run the report.
> >
> > Can I just use my ADO connection to run the report? If not, how can I
> > open Access and run the report via my program code?
> >
> > Thanks
> > Greg Teets
> > Cincinnati Ohio USA
>
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 08, 2005 Posts: 25
|
(Msg. 4) Posted: Tue Feb 15, 2005 12:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Mon, 14 Feb 2005 23:25:53 -0500, "Veign" <NOSPAMinveign.TakeThisOut@veign.com>
wrote:
>You need to use Access Automation:
>
>Something like:
>Dim objAccess as Access.Application
>Set objAccess = New Access.Application
>
>objAccess.OpenCurrentDatabase "C:\MyDB.mdb"
>objAccess.DoCmd.OpenReport "YourReport", acViewPreview
>
>--
>Chris Hanscom - Microsoft MVP (VB)
>Veign's Resource Center
>http://www.veign.com/vrc_main.asp
Thank you.
This is exactly what I needed.
Greg Teets
Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 04, 2004 Posts: 123
|
(Msg. 5) Posted: Tue Feb 15, 2005 1:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Add a reference to the Access Object Library.
Keep in mind each user will have to have a licensed version of Access
installed.
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--
"Greg Teets" <gteets99.TakeThisOut@yahoo.com> wrote in message
news:bhb411pt4a56rr0rp73kbfcalphr7t0nho@4ax.com...
> On Mon, 14 Feb 2005 23:25:53 -0500, "Veign" <NOSPAMinveign.TakeThisOut@veign.com>
> wrote:
>
> >You need to use Access Automation:
> >
> >Something like:
> >Dim objAccess as Access.Application
> >Set objAccess = New Access.Application
> >
> >objAccess.OpenCurrentDatabase "C:\MyDB.mdb"
> >objAccess.DoCmd.OpenReport "YourReport", acViewPreview
> >
> >--
> >Chris Hanscom - Microsoft MVP (VB)
> >Veign's Resource Center
> >http://www.veign.com/vrc_main.asp
>
> Do I need a reference to something to go with this. I know nothing
> about Automation. When I tried to run the code, I got an error:
>
> User-Defined Type Undefined.
>
> Thanks
> Greg Teets
> Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 08, 2005 Posts: 25
|
(Msg. 6) Posted: Tue Feb 15, 2005 1:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Mon, 14 Feb 2005 23:25:53 -0500, "Veign" <NOSPAMinveign.RemoveThis@veign.com>
wrote:
>You need to use Access Automation:
>
>Something like:
>Dim objAccess as Access.Application
>Set objAccess = New Access.Application
>
>objAccess.OpenCurrentDatabase "C:\MyDB.mdb"
>objAccess.DoCmd.OpenReport "YourReport", acViewPreview
>
>--
>Chris Hanscom - Microsoft MVP (VB)
>Veign's Resource Center
>http://www.veign.com/vrc_main.asp
Do I need a reference to something to go with this. I know nothing
about Automation. When I tried to run the code, I got an error:
User-Defined Type Undefined.
Thanks
Greg Teets
Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 08, 2005 Posts: 25
|
(Msg. 7) Posted: Tue Feb 15, 2005 1:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Mon, 14 Feb 2005 23:25:53 -0500, "Veign" <NOSPAMinveign.TakeThisOut@veign.com>
wrote:
>You need to use Access Automation:
>
>Something like:
>Dim objAccess as Access.Application
>Set objAccess = New Access.Application
>
>objAccess.OpenCurrentDatabase "C:\MyDB.mdb"
>objAccess.DoCmd.OpenReport "YourReport", acViewPreview
>
>--
>Chris Hanscom - Microsoft MVP (VB)
>Veign's Resource Center
>http://www.veign.com/vrc_main.asp
Do I need a reference to something to go with this. I know nothing
about Automation. When I tried to run the code, I got an error:
User-Defined Type Undefined.
Thanks
Greg Teets
Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 08, 2005 Posts: 25
|
(Msg. 8) Posted: Tue Feb 15, 2005 2:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Tue, 15 Feb 2005 17:07:41 GMT, Greg Teets <gteets99.RemoveThis@yahoo.com>
wrote:
>On Mon, 14 Feb 2005 23:25:53 -0500, "Veign" <NOSPAMinveign.RemoveThis@veign.com>
>wrote:
>
>>You need to use Access Automation:
>>
>>Something like:
>>Dim objAccess as Access.Application
>>Set objAccess = New Access.Application
>>
>>objAccess.OpenCurrentDatabase "C:\MyDB.mdb"
>>objAccess.DoCmd.OpenReport "YourReport", acViewPreview
>>
>>--
>>Chris Hanscom - Microsoft MVP (VB)
>>Veign's Resource Center
>>http://www.veign.com/vrc_main.asp
>
>Do I need a reference to something to go with this. I know nothing
>about Automation. When I tried to run the code, I got an error:
>
>User-Defined Type Undefined.
>
>Thanks
>Greg Teets
>Cincinnati Ohio USA
I included the reference to the Microsoft Access 9.0 Object Library.
I am using Access 2000.
It does not have a Start method, so I used the Run method.
Set objAccess = Run("Access.Application")
I get an error that says:
Microsoft Access can't find the procedure 'Access.Application.'
Can you tell me how to get this going?
But, I also need a better understanding of this, obviously.
I will try to find documentation for the Access 9.0 Object Library
from the Microsoft Library.
Can you recommend a good article or tutorial on Automation.
Thanks again.
Greg Teets
Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 08, 2005 Posts: 25
|
(Msg. 9) Posted: Tue Feb 15, 2005 2:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Tue, 15 Feb 2005 12:49:26 -0500, "Veign" <NOSPAMinveign.TakeThisOut@veign.com>
wrote:
>Add a reference to the Access Object Library.
>
>Keep in mind each user will have to have a licensed version of Access
>installed.
>
>--
>Chris Hanscom - Microsoft MVP (VB)
>Veign's Resource Center
>http://www.veign.com/vrc_main.asp
Thanks. I found that. Please look at my other message.
Each user does have Microsoft Access. thanks for the reminder.
Greg Teets
Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 04, 2004 Posts: 123
|
(Msg. 10) Posted: Tue Feb 15, 2005 2:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Try the code I posted
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--
"Greg Teets" <gteets99.DeleteThis@yahoo.com> wrote in message
news:e9e4111eovfslrltpvjg89n9ea0rkis4r3@4ax.com...
> On Tue, 15 Feb 2005 17:07:41 GMT, Greg Teets <gteets99.DeleteThis@yahoo.com>
> wrote:
>
> >On Mon, 14 Feb 2005 23:25:53 -0500, "Veign" <NOSPAMinveign.DeleteThis@veign.com>
> >wrote:
> >
> >>You need to use Access Automation:
> >>
> >>Something like:
> >>Dim objAccess as Access.Application
> >>Set objAccess = New Access.Application
> >>
> >>objAccess.OpenCurrentDatabase "C:\MyDB.mdb"
> >>objAccess.DoCmd.OpenReport "YourReport", acViewPreview
> >>
> >>--
> >>Chris Hanscom - Microsoft MVP (VB)
> >>Veign's Resource Center
> >>http://www.veign.com/vrc_main.asp
> >
> >Do I need a reference to something to go with this. I know nothing
> >about Automation. When I tried to run the code, I got an error:
> >
> >User-Defined Type Undefined.
> >
> >Thanks
> >Greg Teets
> >Cincinnati Ohio USA
>
> I included the reference to the Microsoft Access 9.0 Object Library.
> I am using Access 2000.
>
> It does not have a Start method, so I used the Run method.
>
> Set objAccess = Run("Access.Application")
>
> I get an error that says:
>
> Microsoft Access can't find the procedure 'Access.Application.'
>
> Can you tell me how to get this going?
>
> But, I also need a better understanding of this, obviously.
> I will try to find documentation for the Access 9.0 Object Library
> from the Microsoft Library.
>
> Can you recommend a good article or tutorial on Automation.
>
> Thanks again.
> Greg Teets
> Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 08, 2005 Posts: 25
|
(Msg. 11) Posted: Tue Feb 15, 2005 2:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Tue, 15 Feb 2005 13:25:40 -0500, "Veign" <NOSPAMinveign.RemoveThis@veign.com>
wrote:
>Try the code I posted
>
>--
>Chris Hanscom - Microsoft MVP (VB)
>Veign's Resource Center
>http://www.veign.com/vrc_main.asp
I did. I just changed the variable names, unless you spotted a
mistake I made.
Thanks.
Greg Teets
Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 08, 2005 Posts: 25
|
(Msg. 12) Posted: Tue Feb 15, 2005 3:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Tue, 15 Feb 2005 13:25:40 -0500, "Veign" <NOSPAMinveign DeleteThis @veign.com>
wrote:
>Try the code I posted
>
>--
>Chris Hanscom - Microsoft MVP (VB)
>Veign's Resource Center
>http://www.veign.com/vrc_main.asp
Here is my code. Now I get no errors and nothing happens.
Private Sub cmdRunInvoice_Click()
'You need to use Access Automation:
'
'Something like:
On Error GoTo ExecuteError
Dim objAccess As Access.Application
Set objAccess = New Access.Application
objAccess.OpenCurrentDatabase "C:\Current Database\old.mdb"
objAccess.DoCmd.OpenReport "Invoice", acViewPreview
'
'--
'Chris Hanscom - Microsoft MVP (VB)
'Veign 's Resource Center
'http://www.veign.com/vrc_main.asp
Exit Sub
ExecuteError:
Debug.Print "*** Error executing command in RunInvoice_Click ***"
& Err.Description
Exit Sub
End Sub
Greg Teets
Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 08, 2005 Posts: 25
|
(Msg. 13) Posted: Tue Feb 15, 2005 3:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
On Tue, 15 Feb 2005 19:33:05 GMT, Greg Teets <gteets99.DeleteThis@yahoo.com>
wrote:
>On Tue, 15 Feb 2005 13:25:40 -0500, "Veign" <NOSPAMinveign.DeleteThis@veign.com>
>wrote:
>
>>Try the code I posted
>>
>>--
>>Chris Hanscom - Microsoft MVP (VB)
>>Veign's Resource Center
>>http://www.veign.com/vrc_main.asp
>
>Here is my code. Now I get no errors and nothing happens.
>
>Private Sub cmdRunInvoice_Click()
>'You need to use Access Automation:
>'
>'Something like:
> On Error GoTo ExecuteError
> Dim objAccess As Access.Application
> Set objAccess = New Access.Application
>
> objAccess.OpenCurrentDatabase "C:\Current Database\old.mdb"
> objAccess.DoCmd.OpenReport "Invoice", acViewPreview
>'
>'--
>'Chris Hanscom - Microsoft MVP (VB)
>'Veign 's Resource Center
>'http://www.veign.com/vrc_main.asp
>
> Exit Sub
>
>ExecuteError:
> Debug.Print "*** Error executing command in RunInvoice_Click ***"
>& Err.Description
> Exit Sub
>
>End Sub
>
>Greg Teets
>Cincinnati Ohio USA
It worked when I added parentheses:
objAccess.DoCmd.OpenReport ("Invoice", acViewPreview)
Can you recommend a good article or tutorial on Automation?
Thanks for your help.
Greg Teets
Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Feb 04, 2004 Posts: 123
|
(Msg. 14) Posted: Tue Feb 15, 2005 3:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
Sorry, I don't know of any Access Automation website offhand....Try Google..
If you get stuck try posting in the Access Macro newsgroup as those guys
would have a better understanding of the Access object model - they may also
know of some resources for you...
Good luck..
--
Chris Hanscom - Microsoft MVP (VB)
Veign's Resource Center
<a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp" target="_blank">http://www.veign.com/vrc_main.asp</a>
--
"Greg Teets" <gteets99.TakeThisOut@yahoo.com> wrote in message
news:1ek411lidtj1bgr9e0onjcj6rhggo2b7bt@4ax.com...
> On Tue, 15 Feb 2005 19:33:05 GMT, Greg Teets <gteets99.TakeThisOut@yahoo.com>
> wrote:
>
> >On Tue, 15 Feb 2005 13:25:40 -0500, "Veign" <NOSPAMinveign.TakeThisOut@veign.com>
> >wrote:
> >
> >>Try the code I posted
> >>
> >>--
> >>Chris Hanscom - Microsoft MVP (VB)
> >>Veign's Resource Center
> >>http://www.veign.com/vrc_main.asp
> >
> >Here is my code. Now I get no errors and nothing happens.
> >
> >Private Sub cmdRunInvoice_Click()
> >'You need to use Access Automation:
> >'
> >'Something like:
> > On Error GoTo ExecuteError
> > Dim objAccess As Access.Application
> > Set objAccess = New Access.Application
> >
> > objAccess.OpenCurrentDatabase "C:\Current Database\old.mdb"
> > objAccess.DoCmd.OpenReport "Invoice", acViewPreview
> >'
> >'--
> >'Chris Hanscom - Microsoft MVP (VB)
> >'Veign 's Resource Center
> >'http://www.veign.com/vrc_main.asp
> >
> > Exit Sub
> >
> >ExecuteError:
> > Debug.Print "*** Error executing command in RunInvoice_Click ***"
> >& Err.Description
> > Exit Sub
> >
> >End Sub
> >
> >Greg Teets
> >Cincinnati Ohio USA
>
>
> It worked when I added parentheses:
> objAccess.DoCmd.OpenReport ("Invoice", acViewPreview)
>
> Can you recommend a good article or tutorial on Automation?
>
> Thanks for your help.
> Greg Teets
> Cincinnati Ohio USA<!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |
External

Since: Mar 14, 2004 Posts: 1625
|
(Msg. 15) Posted: Tue Feb 15, 2005 6:40 pm
Post subject: Re: How do I run a report in Access from Visual Basic? [Login to view extended thread Info.] Archived from groups: per prev. post (more info?)
|
|
|
ACC: How to Use Automation to Print Microsoft Access Reports:
<a style='text-decoration: underline;' href="http://support.microsoft.com/?id=145707" target="_blank">http://support.microsoft.com/?id=145707</a>
ACC2000: How to Use Automation to Print Microsoft Access Reports
<a style='text-decoration: underline;' href="http://support.microsoft.com/?id=210132" target="_blank">http://support.microsoft.com/?id=210132</a>
ACC2002: How to Use Automation to Print Microsoft Access Reports
<a style='text-decoration: underline;' href="http://support.microsoft.com/?id=296586" target="_blank">http://support.microsoft.com/?id=296586</a>
ACC: Using Microsoft Access as an Automation Server
<a style='text-decoration: underline;' href="http://support.microsoft.com/?id=147816" target="_blank">http://support.microsoft.com/?id=147816</a>
ACC2000: Using Microsoft Access as an Automation Server
<a style='text-decoration: underline;' href="http://support.microsoft.com/?id=210111" target="_blank">http://support.microsoft.com/?id=210111</a>
--
Doug Steele, Microsoft Access MVP
<a style='text-decoration: underline;' href="http://I.Am/DougSteele" target="_blank">http://I.Am/DougSteele</a>
(no e-mails, please!)
"Veign" <NOSPAMinveign RemoveThis @veign.com> wrote in message
news:%23gU0Xh5EFHA.2564@tk2msftngp13.phx.gbl...
> Sorry, I don't know of any Access Automation website offhand....Try
> Google..
>
> If you get stuck try posting in the Access Macro newsgroup as those guys
> would have a better understanding of the Access object model - they may
> also
> know of some resources for you...
>
> Good luck..
>
> --
> Chris Hanscom - Microsoft MVP (VB)
> Veign's Resource Center
<font color=purple> > <a style='text-decoration: underline;' href="http://www.veign.com/vrc_main.asp</font" target="_blank">http://www.veign.com/vrc_main.asp</font</a>>
> --
>
> "Greg Teets" <gteets99 RemoveThis @yahoo.com> wrote in message
> news:1ek411lidtj1bgr9e0onjcj6rhggo2b7bt@4ax.com...
>> On Tue, 15 Feb 2005 19:33:05 GMT, Greg Teets <gteets99 RemoveThis @yahoo.com>
>> wrote:
>>
>> >On Tue, 15 Feb 2005 13:25:40 -0500, "Veign" <NOSPAMinveign RemoveThis @veign.com>
>> >wrote:
>> >
>> >>Try the code I posted
>> >>
>> >>--
>> >>Chris Hanscom - Microsoft MVP (VB)
>> >>Veign's Resource Center
>> >>http://www.veign.com/vrc_main.asp
>> >
>> >Here is my code. Now I get no errors and nothing happens.
>> >
>> >Private Sub cmdRunInvoice_Click()
>> >'You need to use Access Automation:
>> >'
>> >'Something like:
>> > On Error GoTo ExecuteError
>> > Dim objAccess As Access.Application
>> > Set objAccess = New Access.Application
>> >
>> > objAccess.OpenCurrentDatabase "C:\Current Database\old.mdb"
>> > objAccess.DoCmd.OpenReport "Invoice", acViewPreview
>> >'
>> >'--
>> >'Chris Hanscom - Microsoft MVP (VB)
>> >'Veign 's Resource Center
>> >'http://www.veign.com/vrc_main.asp
>> >
>> > Exit Sub
>> >
>> >ExecuteError:
>> > Debug.Print "*** Error executing command in RunInvoice_Click ***"
>> >& Err.Description
>> > Exit Sub
>> >
>> >End Sub
>> >
>> >Greg Teets
>> >Cincinnati Ohio USA
>>
>>
>> It worked when I added parentheses:
>> objAccess.DoCmd.OpenReport ("Invoice", acViewPreview)
>>
>> Can you recommend a good article or tutorial on Automation?
>>
>> Thanks for your help.
>> Greg Teets
>> Cincinnati Ohio USA
>
><!-- ~MESSAGE_AFTER~ --> >> Stay informed about: How do I run a report in Access from Visual Basic? |
|
| Back to top |
|
 |  |