Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. connecting Access v. 95 DB over LAN vb6 win7 OS

connecting Access v. 95 DB over LAN vb6 win7 OS

Scheduled Pinned Locked Moved Visual Basic
databasehelpcsharpsysadmin
12 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L loid grey manuel

    hi, i have a problem with my project. i have an existing system which is a stand alone app. using ms access 95 file format, created in VB6 using Visual Data Manager... well because it's a bit old system. but is runs quit very well. the system owners decided to make the app. run over the network, they have a total of 10 workstations on their office. 1 is for the primary admin (Win7 OS) and 4 is for staff (Win7 OS). 5 are for users (Win XP SP2 OS). the database is located at workstation 1, the other computers wants to access the database. here is a sample code given to me:

    Option Explicit
    Dim Conn As New ADODB.Connection
    Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\IP Address or Computer Name\DIR\masterFile.mdb"

    as the path but i get an error "User-Define not defined" on

    Dim Conn As New ADODB.Connection

    am i missing something like an add-on or reference maybe, like in C# we used to add the reference for SQL connection. do i need to install something?

    D Offline
    D Offline
    DaveAuld
    wrote on last edited by
    #3

    Are you saying that you throw an exception when you try to declare Conn? This is VB6 isn't it?

    Dave Find Me On: Web|Facebook|Twitter|LinkedIn


    Folding Stats: Team CodeProject

    1 Reply Last reply
    0
    • L loid grey manuel

      hi, i have a problem with my project. i have an existing system which is a stand alone app. using ms access 95 file format, created in VB6 using Visual Data Manager... well because it's a bit old system. but is runs quit very well. the system owners decided to make the app. run over the network, they have a total of 10 workstations on their office. 1 is for the primary admin (Win7 OS) and 4 is for staff (Win7 OS). 5 are for users (Win XP SP2 OS). the database is located at workstation 1, the other computers wants to access the database. here is a sample code given to me:

      Option Explicit
      Dim Conn As New ADODB.Connection
      Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\IP Address or Computer Name\DIR\masterFile.mdb"

      as the path but i get an error "User-Define not defined" on

      Dim Conn As New ADODB.Connection

      am i missing something like an add-on or reference maybe, like in C# we used to add the reference for SQL connection. do i need to install something?

      D Offline
      D Offline
      Dave Kreskowiak
      wrote on last edited by
      #4

      Shouldn't that be "\\ComputerName\SHARENAME\DIR\masterfile.mdb"?

      A guide to posting questions on CodeProject[^]
      Dave Kreskowiak

      1 Reply Last reply
      0
      • L loid grey manuel

        hi, i have a problem with my project. i have an existing system which is a stand alone app. using ms access 95 file format, created in VB6 using Visual Data Manager... well because it's a bit old system. but is runs quit very well. the system owners decided to make the app. run over the network, they have a total of 10 workstations on their office. 1 is for the primary admin (Win7 OS) and 4 is for staff (Win7 OS). 5 are for users (Win XP SP2 OS). the database is located at workstation 1, the other computers wants to access the database. here is a sample code given to me:

        Option Explicit
        Dim Conn As New ADODB.Connection
        Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\IP Address or Computer Name\DIR\masterFile.mdb"

        as the path but i get an error "User-Define not defined" on

        Dim Conn As New ADODB.Connection

        am i missing something like an add-on or reference maybe, like in C# we used to add the reference for SQL connection. do i need to install something?

        S Offline
        S Offline
        slam Iqbal
        wrote on last edited by
        #5

        Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\IP Address or Computer Name\DIR\masterFile.mdb" Looks correct(if you replace with valid IP and DIR) but the error "User-Define not defined" tells that you didn't add the reference to your project. To add the reference: click Project menu and Click References. Now tick the checkbox 'Microsoft ActiveX Data Objects 2.x Library'.

        L 1 Reply Last reply
        0
        • S slam Iqbal

          Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\IP Address or Computer Name\DIR\masterFile.mdb" Looks correct(if you replace with valid IP and DIR) but the error "User-Define not defined" tells that you didn't add the reference to your project. To add the reference: click Project menu and Click References. Now tick the checkbox 'Microsoft ActiveX Data Objects 2.x Library'.

          L Offline
          L Offline
          loid grey manuel
          wrote on last edited by
          #6

          thanks. i was able to open the database, but i cant seem to transfer the data to my record set

          Dim cn As ADODB.Connection
          Dim myRecordSet As ADODB.Recordset
          'Dim strsql As String

          'get db path
          Set cn = New ADODB.Connection
          cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\" & "ucuMasterFile.mdb ;Persist Security Info = False"
          cn.Open

          I get error on this line

          MsgBox (myRecordSet.Fields("AdminId"))

          the error is

          runtym err '91'
          object variable or with block variable not set

          modified on Friday, March 25, 2011 6:15 AM

          L S 2 Replies Last reply
          0
          • L loid grey manuel

            thanks. i was able to open the database, but i cant seem to transfer the data to my record set

            Dim cn As ADODB.Connection
            Dim myRecordSet As ADODB.Recordset
            'Dim strsql As String

            'get db path
            Set cn = New ADODB.Connection
            cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\" & "ucuMasterFile.mdb ;Persist Security Info = False"
            cn.Open

            I get error on this line

            MsgBox (myRecordSet.Fields("AdminId"))

            the error is

            runtym err '91'
            object variable or with block variable not set

            modified on Friday, March 25, 2011 6:15 AM

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #7

            Can you show us the line where you assign a value to the MyRecordSet object? Have you verified that AdminId is not null for that particular record?

            I are Troll :suss:

            L 1 Reply Last reply
            0
            • L Lost User

              Can you show us the line where you assign a value to the MyRecordSet object? Have you verified that AdminId is not null for that particular record?

              I are Troll :suss:

              L Offline
              L Offline
              loid grey manuel
              wrote on last edited by
              #8

              after a long search i was able obtain the data needed for login. using the code below

              Dim cn As ADODB.Connection
              Dim myRecordSet As ADODB.Recordset
              Dim strsql As String

              'get db path
              Set cn = New ADODB.Connection
              cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\IP Address or PC name\ucu\ucuMasterFile.mdb ;Persist Security Info = False"
              cn.Open
              Set myRecordSet = cn.Execute("Select * from tblAdmin")

              i was able show the AdminId and PW using a MsgBox.. but when i try to login, somehow it does not allow me to continue. maybe with the verification? here is the code for login:

              Private Sub mnuLogin_Click()
              If myRecordSet.BOF = True And myRecordSet.EOF = True Then
              Exit Sub
              End If

                  myRecordSet.MoveFirst
                  Do
                      If myRecordSet.Fields("AdminId") = txtid.Text And myRecordSet.Fields("AdminPw") = txtpw.Text Then
                          Unload Me
                          Unload frmTest
                          ucuLibMain.Show
                          Exit Sub
                      Else
                          lblerror.Caption = "Unable to Login: Invalid Username and/or Password"
              
                      End If
                      
                      myRecordSet.MoveNext
                  Loop Until myRecordSet.EOF
              

              End Sub

              i get an error

              runtym err '91'
              object variable or with block variable not set

              on the first line

              If myRecordSet.BOF = True And myRecordSet.EOF = True Then

              so i can't continue.. need help. thanks again for quick replies..

              modified on Friday, March 25, 2011 10:14 AM

              1 Reply Last reply
              0
              • L loid grey manuel

                thanks. i was able to open the database, but i cant seem to transfer the data to my record set

                Dim cn As ADODB.Connection
                Dim myRecordSet As ADODB.Recordset
                'Dim strsql As String

                'get db path
                Set cn = New ADODB.Connection
                cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\" & "ucuMasterFile.mdb ;Persist Security Info = False"
                cn.Open

                I get error on this line

                MsgBox (myRecordSet.Fields("AdminId"))

                the error is

                runtym err '91'
                object variable or with block variable not set

                modified on Friday, March 25, 2011 6:15 AM

                S Offline
                S Offline
                slam Iqbal
                wrote on last edited by
                #9

                Does the error occur on remote(Client) PC or your own PC(vb6 installed)? If its client PC, then you have to uose 'Package & Deployment Wizard' to redistribute on client PC. Be sure you add Ms Data access components. W7 is not a good place to run vb6 app.

                L 1 Reply Last reply
                0
                • S slam Iqbal

                  Does the error occur on remote(Client) PC or your own PC(vb6 installed)? If its client PC, then you have to uose 'Package & Deployment Wizard' to redistribute on client PC. Be sure you add Ms Data access components. W7 is not a good place to run vb6 app.

                  L Offline
                  L Offline
                  loid grey manuel
                  wrote on last edited by
                  #10

                  maybe because i'm using a Win7 OS. but i am using VM ware to program in vb6. would it somehow affect the networking part?

                  S 1 Reply Last reply
                  0
                  • L loid grey manuel

                    maybe because i'm using a Win7 OS. but i am using VM ware to program in vb6. would it somehow affect the networking part?

                    S Offline
                    S Offline
                    slam Iqbal
                    wrote on last edited by
                    #11

                    If Set myRecordSet = cn.Execute("Select * from tblAdmin") works then all the query will work fine(if your schema allows). We need details about you problem. Finally i would like to say that you leave vb6 and download VS2010 form Microsoft[^] and you will see you were coding in dark age while using vb6. If you still want vb6 you are wasting your time and life.

                    L 1 Reply Last reply
                    0
                    • S slam Iqbal

                      If Set myRecordSet = cn.Execute("Select * from tblAdmin") works then all the query will work fine(if your schema allows). We need details about you problem. Finally i would like to say that you leave vb6 and download VS2010 form Microsoft[^] and you will see you were coding in dark age while using vb6. If you still want vb6 you are wasting your time and life.

                      L Offline
                      L Offline
                      loid grey manuel
                      wrote on last edited by
                      #12

                      well, unfortunately for me... but, some clients still uses legacy apps. especially vb apps. so what can i complain about? This is what they require.. i have given them option to upgrade, well, they will have to think about it... but anyways, thanks for the the sample code.., i got the project running over the LAN, but for XP only.. i advised the owner of the system not to transfer the system to win7 OS.. or compatibility issues may arise.. [RESOLVED]

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups