473,406 Members | 2,387 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

MS Access Reports and VB.NET Program

I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.

Aug 16 '06 #1
16 6476
Is using Crystal Reports an option for you? Does you version of VS.NET
come with Crystal?
JoeW wrote:
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.
Aug 16 '06 #2
Well, yes I have crystal reports, although my experience is quite
limited with it... have you found it is easier to use than MS Access?
I just need something to display a simple report. I'm wide open to
suggestions, and can pick up on most things if I have a chance to work
on it a bit.

Thanks for your help.
-joe
Izzy wrote:
Is using Crystal Reports an option for you? Does you version of VS.NET
come with Crystal?
JoeW wrote:
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.
Aug 16 '06 #3
Just because Crystal comes with VS, does not mean that it is free to deploy.
There is a licensing charge for deploying CR. From my experience working
with CR (back in 1997), Access was much better of a reporting tool than CR
for developers. It didn't have as good of an end user designer however.

You may want to consider the ReportViewer in 2005 or one of the third party
report tools. I do believe you can run Access reports via interop, but have
not tried it. You should be able to find samples on the web to do this.

Jim Wooley
http://devauthority.com/blogs/jwooley/default.aspx
Well, yes I have crystal reports, although my experience is quite
limited with it... have you found it is easier to use than MS Access?
I just need something to display a simple report. I'm wide open to
suggestions, and can pick up on most things if I have a chance to work
on it a bit.

Thanks for your help.
-joe
Izzy wrote:
>Is using Crystal Reports an option for you? Does you version of
VS.NET come with Crystal?

JoeW wrote:
>>I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report,
that I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load
the

database. Just wondering if anyone has any experience with this,
and what I should do.

Thanks for any help you can offer.

Aug 16 '06 #4
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)

Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub

--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------

"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.

Aug 16 '06 #5
or of course you could just shell to the macro

c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname

right?

isn't that easier?

Access reports kick Crystal's ass

-aaron
George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)

Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub

--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------

"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.
Aug 17 '06 #6
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.

If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.

Izzy

aa*********@gmail.com wrote:
or of course you could just shell to the macro

c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname

right?

isn't that easier?

Access reports kick Crystal's ass

-aaron
George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)

Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub

--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------

"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the
>
database. Just wondering if anyone has any experience with this, and
what I should do.
>
Thanks for any help you can offer.
>
Aug 21 '06 #7
Izzy;

you're a fucking DIPSHIT for starters.

you should use Access Data Projects instead of Crystal.

or Reporting Services.

Crystal is DEAD WEIGHT.

you can't even query Crystal Reports Report Definitions can you?

'Which of these 200 Crystal Reports point to database X'

Crystal Reports and Access can answer this question.
Can Crystal??

-Aaron
Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.

If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.

Izzy

aa*********@gmail.com wrote:
or of course you could just shell to the macro

c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname

right?

isn't that easier?

Access reports kick Crystal's ass

-aaron
George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)
>
Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub
>
--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------
>
"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.
Aug 21 '06 #8
if you upgrade your database to SQL Server you don't have to rewrite
anything; except maybe a couple of sprocs.

-Aaron
Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.

If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.

Izzy

aa*********@gmail.com wrote:
or of course you could just shell to the macro

c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname

right?

isn't that easier?

Access reports kick Crystal's ass

-aaron
George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)
>
Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub
>
--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------
>
"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.
Aug 21 '06 #9

aa*********@gmail.com wrote:
Izzy;

you're a fucking DIPSHIT for starters.
You seem like a real likable guy yourself. Do you feel better about
yourself when you put down others? Can we try to have a professional
exchange of ideas now?! Great.
>
you should use Access Data Projects instead of Crystal.

or Reporting Services.

Crystal is DEAD WEIGHT.
I've had no problems with Crystal or Access. Your obviously emotionally
attached to Access, and unable to see the benefits of both or give
informed professional guidance.
>
you can't even query Crystal Reports Report Definitions can you?
Never needed too, but I'll look into it.
>
'Which of these 200 Crystal Reports point to database X'
Naming conventions could answer that questions. Grouping reports in
your VS.NET project could also easily satisfy that question. I have a
..NET project with around 60 reports that query 4 different databases.
By grouping the reports in folders I can easily tell which database a
report queries, don't need to run a query to do that.
>
Crystal Reports and Access can answer this question.
Can Crystal??

-Aaron
Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.

If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.

Izzy

aa*********@gmail.com wrote:
or of course you could just shell to the macro
>
c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname
>
right?
>
isn't that easier?
>
Access reports kick Crystal's ass
>
-aaron
>
>
George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)

Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub

--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------

"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the
>
database. Just wondering if anyone has any experience with this, and
what I should do.
>
Thanks for any help you can offer.
>
Aug 21 '06 #10

aa*********@gmail.com wrote:
if you upgrade your database to SQL Server you don't have to rewrite
anything; except maybe a couple of sprocs.
Aaron,

Lets say he did upgrade his Access database to Sql Server. Keeping in
mind he's using .NET too write his client app. Are you suggesting using
..NET (which can query Sql Server more efficiently than the Jet engine
using ADO.NET) to send a request to Access which will in turn query Sql
Server sending the results back to Access and be displayed in .NET?

Talk about a performance nightmare.

I'm not saying no one should use Access as thier front end tool. Access
works just fine for some and not for others.

What I'm saying is if you are using Sql Server as your back end and
VB.NET as your front end, then why would you use Access? Unless you
were emotionally attached too it.

Unlock your mind sir.
>
-Aaron
Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.

If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.

Izzy

aa*********@gmail.com wrote:
or of course you could just shell to the macro
>
c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname
>
right?
>
isn't that easier?
>
Access reports kick Crystal's ass
>
-aaron
>
>
George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)

Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub

--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------

"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the
>
database. Just wondering if anyone has any experience with this, and
what I should do.
>
Thanks for any help you can offer.
>
Aug 21 '06 #11
Crystal reports has 1/3rd of the functionality of MS Access.

Can Crystal be used for Sproc development?
Can Crystal be used for Data Entry?

Can you even right-click SORT in crystal?

LOL

grow some balls ADP is the most powerful platform anywhere in the
world.
Right-click SORT, Right-click FILTER

I mean come on

-Aaron


Izzy wrote:
aa*********@gmail.com wrote:
Izzy;

you're a fucking DIPSHIT for starters.

You seem like a real likable guy yourself. Do you feel better about
yourself when you put down others? Can we try to have a professional
exchange of ideas now?! Great.

you should use Access Data Projects instead of Crystal.

or Reporting Services.

Crystal is DEAD WEIGHT.

I've had no problems with Crystal or Access. Your obviously emotionally
attached to Access, and unable to see the benefits of both or give
informed professional guidance.

you can't even query Crystal Reports Report Definitions can you?

Never needed too, but I'll look into it.

'Which of these 200 Crystal Reports point to database X'

Naming conventions could answer that questions. Grouping reports in
your VS.NET project could also easily satisfy that question. I have a
.NET project with around 60 reports that query 4 different databases.
By grouping the reports in folders I can easily tell which database a
report queries, don't need to run a query to do that.

Crystal Reports and Access can answer this question.
Can Crystal??

-Aaron
Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.
>
If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.
>
Izzy
>
aa*********@gmail.com wrote:
or of course you could just shell to the macro

c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname

right?

isn't that easier?

Access reports kick Crystal's ass

-aaron


George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)
>
Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub
>
--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------
>
"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.
Aug 22 '06 #12
..NET for a client app?

I'd have written it in ADP and I'd be done in 1/4 of the time!

Who gives a crap about .NET for client development?? I mean; do you
think that I want to ship a 30mb .NET framework to each of my clients?

I mean seriously.. Friggin Idiots!

Keep it in Access Data Projects; no linked tables; nothing complex..
just a single simple ADO connection.

It is Access TIMES eCommerce TIMES Sql Server.

-Aaron
Izzy wrote:
aa*********@gmail.com wrote:
if you upgrade your database to SQL Server you don't have to rewrite
anything; except maybe a couple of sprocs.

Aaron,

Lets say he did upgrade his Access database to Sql Server. Keeping in
mind he's using .NET too write his client app. Are you suggesting using
.NET (which can query Sql Server more efficiently than the Jet engine
using ADO.NET) to send a request to Access which will in turn query Sql
Server sending the results back to Access and be displayed in .NET?

Talk about a performance nightmare.

I'm not saying no one should use Access as thier front end tool. Access
works just fine for some and not for others.

What I'm saying is if you are using Sql Server as your back end and
VB.NET as your front end, then why would you use Access? Unless you
were emotionally attached too it.

Unlock your mind sir.

-Aaron
Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.
>
If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.
>
Izzy
>
aa*********@gmail.com wrote:
or of course you could just shell to the macro

c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname

right?

isn't that easier?

Access reports kick Crystal's ass

-aaron


George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)
>
Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub
>
--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------
>
"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.
Aug 22 '06 #13

aa*********@gmail.com wrote:
.NET for a client app?

I'd have written it in ADP and I'd be done in 1/4 of the time!
It's not always about you Aaron. Maybe you should write that down and
read it once a day, I think it might help.
>
Who gives a crap about .NET for client development?? I mean; do you
think that I want to ship a 30mb .NET framework to each of my clients?
Well let's see...including myself....millions of developers
worldwide. Except you because you're emotionally attached to one
platform. Someday when you get done playing with your toy (ADP) you can
step into the real development community with the rest of us.

If your clients are running Windows XP then the framework is already
there. Oh but wait...my bad I just realized how emotionally attached
you get to things...your clients pc's are probably still running
Windows 9x.

You know, Barns & Noble has some books that could help you learn .NET.
You're probably thinking all their books are way too advanced for
you, but just start with ".NET For Dummies". You can even read it 2 or
3 times if it helps.

>
I mean seriously.. Friggin Idiots!
There you go again, a piece of advice Aaron: If you're incapable of
having an intelligent exchange, then it's best to say nothing.
Otherwise you say things like the above and then everyone knows how
ignorant you are.
>
Keep it in Access Data Projects; no linked tables; nothing complex..
just a single simple ADO connection.
Do some research Aaron, ADO.NET is faster and all around better then
ADO. Your clients will gain performance and your Sql Server will gain
performance. Aaron....step away from the Access books, I know you are
attached to them but you'll like the new .NET books just as much.
>
It is Access TIMES eCommerce TIMES Sql Server.
Yeah, do your users a favor and go read some books. I love the fact
that you actually posted how to execute the report using a macro. Back
in the day when I did Access development, We use to laugh about
developers who use macros. I'll be sure and forward this to some of my
development buddies so they can get a good laugh. MACRO'S.....LOL

We'll this has been fun Aaron, now reposting here will be a waist of
your time (not as if your not doing that already with ADP). I'm not
reading anymore from you, nor will I be reposting.

Look, all sarcasm aside, read some books and take an objective look at
..NET.

VBA is a toy...always has been....always will be.
>
-Aaron
Izzy wrote:
aa*********@gmail.com wrote:
if you upgrade your database to SQL Server you don't have to rewrite
anything; except maybe a couple of sprocs.
Aaron,

Lets say he did upgrade his Access database to Sql Server. Keeping in
mind he's using .NET too write his client app. Are you suggesting using
.NET (which can query Sql Server more efficiently than the Jet engine
using ADO.NET) to send a request to Access which will in turn query Sql
Server sending the results back to Access and be displayed in .NET?

Talk about a performance nightmare.

I'm not saying no one should use Access as thier front end tool. Access
works just fine for some and not for others.

What I'm saying is if you are using Sql Server as your back end and
VB.NET as your front end, then why would you use Access? Unless you
were emotionally attached too it.

Unlock your mind sir.
>
-Aaron
>
>
Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.

If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.

Izzy

aa*********@gmail.com wrote:
or of course you could just shell to the macro
>
c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname
>
right?
>
isn't that easier?
>
Access reports kick Crystal's ass
>
-aaron
>
>
George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)

Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub

--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------

"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the
>
database. Just wondering if anyone has any experience with this, and
what I should do.
>
Thanks for any help you can offer.
>
Aug 22 '06 #14

aa*********@gmail.com wrote:
Crystal reports has 1/3rd of the functionality of MS Access.
Not true, I've used both. Crystal has some functionality that Access
lacks and vice versa. Both are useful tools when applied to the correct
requirements.
>
Can Crystal be used for Sproc development?
When you say "Sproc" do you really mean Stored Procedure's? AKA "SP" to
real developers.
Absolutely you can, and thier not limited to just one either. Using
ADO.NET I can compile data from many sources for one single report.
Can Crystal be used for Data Entry?
Why on earth would you want too. That's it, I'm not reading anymore
from you.
>
Can you even right-click SORT in crystal?
If your users have to SORT your reports then your not creating the
reports correctly.
>
LOL

grow some balls ADP is the most powerful platform anywhere in the
world.
Right-click SORT, Right-click FILTER

I mean come on

-Aaron


Izzy wrote:
aa*********@gmail.com wrote:
Izzy;
>
you're a fucking DIPSHIT for starters.
You seem like a real likable guy yourself. Do you feel better about
yourself when you put down others? Can we try to have a professional
exchange of ideas now?! Great.
>
you should use Access Data Projects instead of Crystal.
>
or Reporting Services.
>
Crystal is DEAD WEIGHT.
I've had no problems with Crystal or Access. Your obviously emotionally
attached to Access, and unable to see the benefits of both or give
informed professional guidance.
>
you can't even query Crystal Reports Report Definitions can you?
Never needed too, but I'll look into it.
>
'Which of these 200 Crystal Reports point to database X'
Naming conventions could answer that questions. Grouping reports in
your VS.NET project could also easily satisfy that question. I have a
.NET project with around 60 reports that query 4 different databases.
By grouping the reports in folders I can easily tell which database a
report queries, don't need to run a query to do that.
>
Crystal Reports and Access can answer this question.
Can Crystal??
>
-Aaron
>
>
Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.

If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.

Izzy

aa*********@gmail.com wrote:
or of course you could just shell to the macro
>
c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname
>
right?
>
isn't that easier?
>
Access reports kick Crystal's ass
>
-aaron
>
>
George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)

Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub

--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------

"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the
>
database. Just wondering if anyone has any experience with this, and
what I should do.
>
Thanks for any help you can offer.
>
Aug 22 '06 #15
I know vb.net like the back of my hand

ADP isn't a toy.

it's 100 times easier for simple apps; and reporting than all this
'VB.NET Desktop' crap you kids are preaching.

100 times easier to deploy.

It's not 'Access' - as in it's not MDB-- it's real thin Vb6 against SQL
Server.
It kicks ass, for the record.

Rather than paying 3rd-party licensing fees and fighting DLL hell--
don't you wish you could iron out and standardize the UI?

Access ADP is just flat out more powerful than your silly VB.net on the
desktop lol

-Aaron

Izzy wrote:
aa*********@gmail.com wrote:
.NET for a client app?

I'd have written it in ADP and I'd be done in 1/4 of the time!

It's not always about you Aaron. Maybe you should write that down and
read it once a day, I think it might help.

Who gives a crap about .NET for client development?? I mean; do you
think that I want to ship a 30mb .NET framework to each of my clients?

Well let's see...including myself....millions of developers
worldwide. Except you because you're emotionally attached to one
platform. Someday when you get done playing with your toy (ADP) you can
step into the real development community with the rest of us.

If your clients are running Windows XP then the framework is already
there. Oh but wait...my bad I just realized how emotionally attached
you get to things...your clients pc's are probably still running
Windows 9x.

You know, Barns & Noble has some books that could help you learn .NET.
You're probably thinking all their books are way too advanced for
you, but just start with ".NET For Dummies". You can even read it 2 or
3 times if it helps.


I mean seriously.. Friggin Idiots!

There you go again, a piece of advice Aaron: If you're incapable of
having an intelligent exchange, then it's best to say nothing.
Otherwise you say things like the above and then everyone knows how
ignorant you are.

Keep it in Access Data Projects; no linked tables; nothing complex..
just a single simple ADO connection.

Do some research Aaron, ADO.NET is faster and all around better then
ADO. Your clients will gain performance and your Sql Server will gain
performance. Aaron....step away from the Access books, I know you are
attached to them but you'll like the new .NET books just as much.

It is Access TIMES eCommerce TIMES Sql Server.

Yeah, do your users a favor and go read some books. I love the fact
that you actually posted how to execute the report using a macro. Back
in the day when I did Access development, We use to laugh about
developers who use macros. I'll be sure and forward this to some of my
development buddies so they can get a good laugh. MACRO'S.....LOL

We'll this has been fun Aaron, now reposting here will be a waist of
your time (not as if your not doing that already with ADP). I'm not
reading anymore from you, nor will I be reposting.

Look, all sarcasm aside, read some books and take an objective look at
.NET.

VBA is a toy...always has been....always will be.

-Aaron
Izzy wrote:
aa*********@gmail.com wrote:
if you upgrade your database to SQL Server you don't have to rewrite
anything; except maybe a couple of sprocs.
>
Aaron,
>
Lets say he did upgrade his Access database to Sql Server. Keeping in
mind he's using .NET too write his client app. Are you suggesting using
.NET (which can query Sql Server more efficiently than the Jet engine
using ADO.NET) to send a request to Access which will in turn query Sql
Server sending the results back to Access and be displayed in .NET?
>
Talk about a performance nightmare.
>
I'm not saying no one should use Access as thier front end tool. Access
works just fine for some and not for others.
>
What I'm saying is if you are using Sql Server as your back end and
VB.NET as your front end, then why would you use Access? Unless you
were emotionally attached too it.
>
Unlock your mind sir.
>

-Aaron


Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.
>
If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.
>
Izzy
>
aa*********@gmail.com wrote:
or of course you could just shell to the macro

c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname

right?

isn't that easier?

Access reports kick Crystal's ass

-aaron


George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)
>
Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub
>
--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------
>
"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.
Aug 22 '06 #16
VBa has _ALL_ the functionality that you need.

Microsoft just flat-out went the wrong direction when it comes to .NET.

For starters, the XP desktops might have '.net framework 1.0'
installed.. someone might write an SMS app to push 1.1 out to you.
Some desktop users can even pull the .NET 2.0 framework down.

But comparing VBA to your _CRAP_ .NET 1.1?

you dorks can't even edit and continue


Izzy wrote:
aa*********@gmail.com wrote:
.NET for a client app?

I'd have written it in ADP and I'd be done in 1/4 of the time!

It's not always about you Aaron. Maybe you should write that down and
read it once a day, I think it might help.

Who gives a crap about .NET for client development?? I mean; do you
think that I want to ship a 30mb .NET framework to each of my clients?

Well let's see...including myself....millions of developers
worldwide. Except you because you're emotionally attached to one
platform. Someday when you get done playing with your toy (ADP) you can
step into the real development community with the rest of us.

If your clients are running Windows XP then the framework is already
there. Oh but wait...my bad I just realized how emotionally attached
you get to things...your clients pc's are probably still running
Windows 9x.

You know, Barns & Noble has some books that could help you learn .NET.
You're probably thinking all their books are way too advanced for
you, but just start with ".NET For Dummies". You can even read it 2 or
3 times if it helps.


I mean seriously.. Friggin Idiots!

There you go again, a piece of advice Aaron: If you're incapable of
having an intelligent exchange, then it's best to say nothing.
Otherwise you say things like the above and then everyone knows how
ignorant you are.

Keep it in Access Data Projects; no linked tables; nothing complex..
just a single simple ADO connection.

Do some research Aaron, ADO.NET is faster and all around better then
ADO. Your clients will gain performance and your Sql Server will gain
performance. Aaron....step away from the Access books, I know you are
attached to them but you'll like the new .NET books just as much.

It is Access TIMES eCommerce TIMES Sql Server.

Yeah, do your users a favor and go read some books. I love the fact
that you actually posted how to execute the report using a macro. Back
in the day when I did Access development, We use to laugh about
developers who use macros. I'll be sure and forward this to some of my
development buddies so they can get a good laugh. MACRO'S.....LOL

We'll this has been fun Aaron, now reposting here will be a waist of
your time (not as if your not doing that already with ADP). I'm not
reading anymore from you, nor will I be reposting.

Look, all sarcasm aside, read some books and take an objective look at
.NET.

VBA is a toy...always has been....always will be.

-Aaron
Izzy wrote:
aa*********@gmail.com wrote:
if you upgrade your database to SQL Server you don't have to rewrite
anything; except maybe a couple of sprocs.
>
Aaron,
>
Lets say he did upgrade his Access database to Sql Server. Keeping in
mind he's using .NET too write his client app. Are you suggesting using
.NET (which can query Sql Server more efficiently than the Jet engine
using ADO.NET) to send a request to Access which will in turn query Sql
Server sending the results back to Access and be displayed in .NET?
>
Talk about a performance nightmare.
>
I'm not saying no one should use Access as thier front end tool. Access
works just fine for some and not for others.
>
What I'm saying is if you are using Sql Server as your back end and
VB.NET as your front end, then why would you use Access? Unless you
were emotionally attached too it.
>
Unlock your mind sir.
>

-Aaron


Izzy wrote:
While opinions will vary as to which is a better reporting tool,
something else to keep in mind is, the future of your database. If this
database will never grow out of Access then I say write the reports in
Access.
>
If you think this database might someday be upgraded to SQL Server or
Oracle then Crystal will be a much better solution as you wont be
rewriting reports in the future.
>
Izzy
>
aa*********@gmail.com wrote:
or of course you could just shell to the macro

c:\InsertFullPath\MSACCESS.exe "c:\mySilly.mdb" /X macroname

right?

isn't that easier?

Access reports kick Crystal's ass

-aaron


George Shubin wrote:
You need to have the Access application installed (not just the mdb file) on
the computer you want to run the report. Try using this code: (watch out
for word wrap)
>
Public Sub PrintAccessReport(ByVal sReportName As String, Optional ByVal
sQryName As String = "", Optional ByVal sSQL As String = "")
Dim oAccess As New Access.ApplicationClass
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
'Create new query if needed
If sQryName.Length 0 And sSQL.Length 0 Then
Try
'oAccess.CurrentDb.QueryDefs.Delete(sQryName)
oAccess.DoCmd.DeleteObject(Access.AcObjectType.acQ uery, sQryName)
Catch
'Close and reopen the Access object if above statement failed
oAccess.Visible = False
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
oAccess.Visible = True
oAccess.OpenCurrentDatabase("C:\PathTo\Your\Databa se.mdb")
oAccess.DoCmd.Minimize()
End Try
oAccess.CurrentDb.CreateQueryDef(sQryName, sSQL)
End If
'Preview the report
oAccess.DoCmd.OpenReport(sReportName, Access.AcView.acViewPreview, , ,
Access.AcWindowMode.acDialog)
'Close the Access Instance
If Not oAccess Is Nothing Then
' Call Access Quit method without saving any changes.
oAccess.Quit(Access.AcQuitOption.acQuitSaveNone)
' Use Marshal class' ReleaseComObject to release the Access instance.
System.Runtime.InteropServices.Marshal.ReleaseComO bject(oAccess)
' Dereference the oAccess variable.
oAccess = Nothing
End If
End Sub
>
--
------------------------------------------------------------------------
George Shubin Custom Software Development
dX Software Systems Database Applications
Ph: 503-981-6806 Fax: 503-982-0120
www.dxonline.com ge****@dxonline.com
------------------------------------------------------------------------
>
"JoeW" <wa******@stcloudstate.eduwrote in message
news:11**********************@m73g2000cwd.googlegr oups.com...
I'm utilizing a database that I created within MS Access within a
program I've created in VB.NET. I am using the VB front end to
navigate the information, but want to be able to print a report, that
I've also created within MS Access. I've attempted using the
Access.Application instance, but I get errors when it tries to load the

database. Just wondering if anyone has any experience with this, and
what I should do.

Thanks for any help you can offer.
Aug 22 '06 #17

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Teri Welch | last post by:
Hello, We maintain a VB6 front-end application using an Access 2000 database. All code and forms are in VB6. The program also uses several queries/reports defined in Access. For corporate...
7
by: dog | last post by:
I've seen plenty of articles on this topic but none of them have been able to solve my problem. I am working with an Access 97 database on an NT4.0 machine, which has many Access reports. I...
11
by: Grasshopper | last post by:
Hi, I am automating Access reports to PDF using PDF Writer 6.0. I've created a DTS package to run the reports and schedule a job to run this DTS package. If I PC Anywhere into the server on...
16
by: cyranoVR | last post by:
This is the approach I used to automate printing of Microsoft Access reports to PDF format i.e. unattended and without annoying "Save As..." dialogs, and - more importantly - without having to use...
6
by: jdph40 | last post by:
We recently had to upgrade the computers in our company. Now our office's website on our company intranet no longer recognizes reports saved in snapshot format. We get an error message that the...
0
by: timandsuzi36 | last post by:
I have a WinForms App that is launching an Access 2003 db Reports program. I am using the System.Diagnostics.Process object to do so. I thought that I could pass my db connection string to Access...
0
by: Goran | last post by:
Hi I have created a very simple ASP.Net application that only consists of a CrystalReports Viewer, that has been connected to a .rpt file. When the page is loaded in the browser, the following...
13
by: salad | last post by:
Hi Guys: I was stuck. I needed to send a report to a file. My beautiful report(s) in Access were going to require loss of formatting with RTFs, a PITA in WordMailMerge, sending it as a text...
0
by: Mark Gold | last post by:
Hi! We have a VB application using Crystal Reports 6 that has worked successfully on hundreds of systems for over 10 years. Now, on one network, the application and access database does not close....
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.