Results 1 to 5 of 5

Thread: Need some help with a VB.NET error

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2004
    Posts
    14

    Need some help with a VB.NET error

    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.acOutputReport, 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!

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    ok but did you put the database on the target pc as well in a directory with the same name you specified in sDBPath?
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3

    Thread Starter
    New Member
    Join Date
    May 2004
    Posts
    14

    Question

    Yes I have .... I have checked all paths and everything is in order .... any more ideas?

    Great to bring that to my attention in case it was overlooked, but I have everything where it should be!



    In desparate need of help

  4. #4
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    Oh wait. You arent using the normal database objects. You are using some Access specific classes or something. I really dont know what the target computer is going to need for that to work.
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  5. #5

    Thread Starter
    New Member
    Join Date
    May 2004
    Posts
    14
    Thx for the replies .... I appreciate it. I have received assistance from another source specifying that the version of access on the target PC must be the same as the version of the development pc. I checked and they were not. I updated the target PC and it works ... so far anyway!


    Again thx for your help, and maybe this may help anyone else with similar problems!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width