473,480 Members | 1,857 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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

D P
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!
Nov 20 '05 #1
8 1416
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.
Dim oAccess As Access.Application


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
Nov 20 '05 #2

"D P" <is******@hotmail.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
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!

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.
Nov 20 '05 #3
Hi Peter,

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

Cor
Nov 20 '05 #4
* D P <is******@hotmail.com> scripsit:
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)


Ever thought of posting to an Access group?

--
Herfried K. Wagner [MVP]
<URL:http://dotnet.mvps.org/>
Nov 20 '05 #5

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:uy**************@tk2msftngp13.phx.gbl...
Hi Peter,

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

Cor

And, your points is?
Nov 20 '05 #6
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
Nov 20 '05 #7

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OW**************@TK2MSFTNGP09.phx.gbl...
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

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.
Nov 20 '05 #8

"Cor Ligthert" <no**********@planet.nl> wrote in message
news:OW**************@TK2MSFTNGP09.phx.gbl...
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

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.
Nov 20 '05 #9

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

Similar topics

6
6302
by: mike | last post by:
Hello, After trying to validate this page for a couple of days now I was wondering if someone might be able to help me out. Below is a list of snippets where I am having the errors. 1. Line 334,...
1
2244
by: Jung Joon Park | last post by:
Hi everyone. I am JJ Park. I got some questions in C++. First of all, my English is not perfect, because I am foreigner. I have got C++ code, which have no syntex error in Visual C++ ver6.0...
3
2008
by: JGBNS via DotNetMonster.com | last post by:
Hi, I am new to this forumand I apologize as i am not a .net programmer but we have a program being developed by a .net programmer. Nowwe have run into an ftp snag and I think it is part ftp and...
7
3283
by: Timothy Shih | last post by:
Hi, I am trying to figure out how to use unmanaged code using P/Invoke. I wrote a simple function which takes in 2 buffers (one a byte buffer, one a char buffer) and copies the contents of the byte...
4
3172
by: hb | last post by:
Hi, I have been working on the ASP.Net project for months with VS.Net 2003 in C#. But this afternoon I suddenly got the following error when I tied to compile the whole solution: === ------...
0
1613
by: TN Bella | last post by:
Hi, I am trying to get my compare validator to fire properly...Since I have panels the validator wouldn't work properly, the app would fire right but would insert the data regardless and the...
12
5286
by: Noel | last post by:
Hello, I'm currently developing a web service that retrieves data from an employee table. I would like to send and retrieve a custom employee class to/from the webservice. I have currently coded...
8
2709
by: skumar434 | last post by:
i need to store the data from a data base in to structure .............the problem is like this ....suppose there is a data base which stores the sequence no and item type etc ...but i need only...
14
4334
by: confusedfusion | last post by:
Not sure how many form submissions that have been lost over the years before I started but the company has a contact form that the required fields when validation fails the error message is going...
70
5300
mideastgirl
by: mideastgirl | last post by:
I have recently been working on a website for an honors association, and have a lot of difficulty but have found help from those on this site. I would like to see if I can get some more help on a...
0
7055
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6920
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7103
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...
1
6758
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
7010
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
5362
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
4499
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3003
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
203
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.