connecting Access v. 95 DB over LAN vb6 win7 OS
-
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?
-
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?
loid grey manuel wrote:
Conn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=\\IP Address or Computer Name\DIR\masterFile.mdb"
I can only hope IP Address or Computer Name isn't what you are using... :)
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
-
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?
-
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?
Shouldn't that be "\\ComputerName\SHARENAME\DIR\masterfile.mdb"?
A guide to posting questions on CodeProject[^]
Dave Kreskowiak -
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?
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'.
-
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'.
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.OpenI get error on this line
MsgBox (myRecordSet.Fields("AdminId"))
the error is
runtym err '91'
object variable or with block variable not setmodified on Friday, March 25, 2011 6:15 AM
-
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.OpenI get error on this line
MsgBox (myRecordSet.Fields("AdminId"))
the error is
runtym err '91'
object variable or with block variable not setmodified on Friday, March 25, 2011 6:15 AM
-
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:
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 IfmyRecordSet.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 seton 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
-
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.OpenI get error on this line
MsgBox (myRecordSet.Fields("AdminId"))
the error is
runtym err '91'
object variable or with block variable not setmodified on Friday, March 25, 2011 6:15 AM
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.
-
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.
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?
-
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?
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. -
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.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]