Connecting Tech Pros Worldwide Forums | Help | Site Map

Need help with a VB.NET error ... please help! Details within

D P
Guest
 
Posts: n/a
#1: Nov 20 '05
Hello everyone, I am new here and I hope I can get the help I need.

I will be as descriptive as possible!!

I have developed an app using VB.NET that requires making a connection
to an access DB that sits on the same machine in which the app is
running. First off, this works PERFECTLY on my PC, but not on the PC
where it will be running.

It needs to open the local database and generate a snapshot of the
report that is specified ( .... the report DOES exist in the DB by the
same name that is used in code).


Here is the code snippet....
(I am using Northwind.mdb as a test DB!!!)

=============================================

Dim oAccess As Access.Application
Dim sDBPath As String 'path to DB
Dim sReport As String


'Testing
sReport = "Summary of Sales by Year"

' Start a new instance of Access for Automation:
oAccess = New Access.Application


sDBPath = "C:\NorthWindODBC\NorthWind.mdb"

***** Error occurs here on OpenDatabase *****
oAccess.OpenCurrentDatabase(filepath:=sDBPath, Exclusive:=False)

oAccess.DoCmd.Minimize()

oAccess.Visible = False



'Output in snapshot format to a temp file

oAccess.DoCmd.OutputTo(Access.AcOutputObjectType.a cOutputReport,
sReport, "Snapshot Format", "C:\NorthWindODBC\temp.snp", False)


'Quit access
oAccess.Quit()

'Free
oAccess = Nothing


==============================================

This works as I mentioned on my PC but not on the PC where it will be
running.

I have dloaded and installed the .NET Framework on the target PC,
installed the latest MDAC.

I have copied the exe and reference file dlls from the bin folder of my
project folder to the target PC ... nothing works. Even creating setup
and installing it.

My PC is Windows XP, and Target is Windows 2000!


The error I get is .....

system.nullreferenceexception: Object Reference not set to an instance
of an object

This error is occuring on the line I indicated above (***)

Any ideas?? Thanks in advance to anyone with any ideas on how to solve
this!

OH .... and I have set permissions and things like that on the DB itself
and the folder where it is located!





*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Cor Ligthert
Guest
 
Posts: n/a
#2: Nov 20 '05

re: Need help with a VB.NET error ... please help! Details within


Hi DP,

I don't see it and if I knew that these questions are often answered I would
not give an answer but wait. However they are not.

Problem is of course that you have to debug on the other computer.

The most probable is that this is the problem.
[color=blue]
> Dim oAccess As Access.Application[/color]

You can this test of course withouth direct debugging by something as

If oAccess Is nothing then messagebox.show("it is nothing")

I hope this helps anyeway?

Cor


Peter van der Goes
Guest
 
Posts: n/a
#3: Nov 20 '05

re: Need help with a VB.NET error ... please help! Details within



"D P" <islesfan@hotmail.com> wrote in message
news:%2359goPmPEHA.3044@TK2MSFTNGP10.phx.gbl...[color=blue]
> Hello everyone, I am new here and I hope I can get the help I need.
>
> I will be as descriptive as possible!!
>
> I have developed an app using VB.NET that requires making a connection
> to an access DB that sits on the same machine in which the app is
> running. First off, this works PERFECTLY on my PC, but not on the PC
> where it will be running.
>
> It needs to open the local database and generate a snapshot of the
> report that is specified ( .... the report DOES exist in the DB by the
> same name that is used in code).
>
>
> Here is the code snippet....
> (I am using Northwind.mdb as a test DB!!!)
>
> =============================================
>
> Dim oAccess As Access.Application
> Dim sDBPath As String 'path to DB
> Dim sReport As String
>
>
> 'Testing
> sReport = "Summary of Sales by Year"
>
> ' Start a new instance of Access for Automation:
> oAccess = New Access.Application
>
>
> sDBPath = "C:\NorthWindODBC\NorthWind.mdb"
>
> ***** Error occurs here on OpenDatabase *****
> oAccess.OpenCurrentDatabase(filepath:=sDBPath, Exclusive:=False)
>
> oAccess.DoCmd.Minimize()
>
> oAccess.Visible = False
>
>
>
> 'Output in snapshot format to a temp file
>
> oAccess.DoCmd.OutputTo(Access.AcOutputObjectType.a cOutputReport,
> sReport, "Snapshot Format", "C:\NorthWindODBC\temp.snp", False)
>
>
> 'Quit access
> oAccess.Quit()
>
> 'Free
> oAccess = Nothing
>
>
> ==============================================
>
> This works as I mentioned on my PC but not on the PC where it will be
> running.
>
> I have dloaded and installed the .NET Framework on the target PC,
> installed the latest MDAC.
>
> I have copied the exe and reference file dlls from the bin folder of my
> project folder to the target PC ... nothing works. Even creating setup
> and installing it.
>
> My PC is Windows XP, and Target is Windows 2000!
>
>
> The error I get is .....
>
> system.nullreferenceexception: Object Reference not set to an instance
> of an object
>
> This error is occuring on the line I indicated above (***)
>
> Any ideas?? Thanks in advance to anyone with any ideas on how to solve
> this!
>
> OH .... and I have set permissions and things like that on the DB itself
> and the folder where it is located!
>
>[/color]
Do you have a full installation of the same version of MS Access on the
target PC as exists on the development PC?
You don't need Access installed to use an Access database with VB.NET, but
you are using an Access application object.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.


Cor Ligthert
Guest
 
Posts: n/a
#4: Nov 20 '05

re: Need help with a VB.NET error ... please help! Details within


Hi Peter,

Was already answered as this by Armin in the other thread in this double
post 2 hours ago.

Cor


Herfried K. Wagner [MVP]
Guest
 
Posts: n/a
#5: Nov 20 '05

re: Need help with a VB.NET error ... please help! Details within


* D P <islesfan@hotmail.com> scripsit:[color=blue]
> I have developed an app using VB.NET that requires making a connection
> to an access DB that sits on the same machine in which the app is
> running. First off, this works PERFECTLY on my PC, but not on the PC
> where it will be running.
>
> It needs to open the local database and generate a snapshot of the
> report that is specified ( .... the report DOES exist in the DB by the
> same name that is used in code).
>
>
> Here is the code snippet....
> (I am using Northwind.mdb as a test DB!!!)
>
> =============================================
>
> Dim oAccess As Access.Application
> Dim sDBPath As String 'path to DB
> Dim sReport As String
>
>
> 'Testing
> sReport = "Summary of Sales by Year"
>
> ' Start a new instance of Access for Automation:
> oAccess = New Access.Application
>
>
> sDBPath = "C:\NorthWindODBC\NorthWind.mdb"
>
> ***** Error occurs here on OpenDatabase *****
> oAccess.OpenCurrentDatabase(filepath:=sDBPath, Exclusive:=False)[/color]

Ever thought of posting to an Access group?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Peter van der Goes
Guest
 
Posts: n/a
#6: Nov 20 '05

re: Need help with a VB.NET error ... please help! Details within



"Cor Ligthert" <notfirstname@planet.nl> wrote in message
news:uyqI0YnPEHA.3596@tk2msftngp13.phx.gbl...[color=blue]
> Hi Peter,
>
> Was already answered as this by Armin in the other thread in this double
> post 2 hours ago.
>
> Cor
>
>[/color]
And, your points is?


Cor Ligthert
Guest
 
Posts: n/a
#7: Nov 20 '05

re: Need help with a VB.NET error ... please help! Details within


Hi Peter,

I shall be wrong, however when I readed your message after I had readed the
solution from Armin one hours before, which was the same as yours, I
thought will we all do that who are active in this newsgroup.

However probably it was just an coincident.

Cor


Peter van der Goes
Guest
 
Posts: n/a
#8: Nov 20 '05

re: Need help with a VB.NET error ... please help! Details within



"Cor Ligthert" <notfirstname@planet.nl> wrote in message
news:OWaRSNpPEHA.2876@TK2MSFTNGP09.phx.gbl...[color=blue]
> Hi Peter,
>
> I shall be wrong, however when I readed your message after I had readed[/color]
the[color=blue]
> solution from Armin one hours before, which was the same as yours, I
> thought will we all do that who are active in this newsgroup.
>
> However probably it was just an coincident.
>
> Cor
>[/color]
Yes it *was* a coincidence. No probably about it. I had not seen the other
thread started by the same OP, nor had I looked for such a thread.
I, like many others here, have limited time to read and respond to requests
for help. When I see a post where I believe I may have an insight, I
respond. I don't scour the newsgroups looking for the possibility that the
OP posted the same question in the same, or other groups multiple times.
The way I see it, a question answered twice is far better than a question
unanswered.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.


Peter van der Goes
Guest
 
Posts: n/a
#9: Nov 20 '05

re: Need help with a VB.NET error ... please help! Details within



"Cor Ligthert" <notfirstname@planet.nl> wrote in message
news:OWaRSNpPEHA.2876@TK2MSFTNGP09.phx.gbl...[color=blue]
> Hi Peter,
>
> I shall be wrong, however when I readed your message after I had readed[/color]
the[color=blue]
> solution from Armin one hours before, which was the same as yours, I
> thought will we all do that who are active in this newsgroup.
>
> However probably it was just an coincident.
>
> Cor
>[/color]
Yes it *was* a coincidence. No probably about it. I had not seen the other
thread started by the same OP, nor had I looked for such a thread.
I, like many others here, have limited time to read and respond to requests
for help. When I see a post where I believe I may have an insight, I
respond. I don't scour the newsgroups looking for the possibility that the
OP posted the same question in the same, or other groups multiple times.
The way I see it, a question answered twice is far better than a question
unanswered.

--
Peter [MVP Visual Developer]
Jack of all trades, master of none.


Closed Thread