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. Vb 6 and access 2000 in LAN

Vb 6 and access 2000 in LAN

Scheduled Pinned Locked Moved Visual Basic
questiondatabasesysadmintutorial
14 Posts 2 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.
  • A arunendra

    Hi! I have developed an application using visual basic 6. I have used access 2000 database and crystal report( for reporting). Now, i want the database to stay in one machine of the workgroup so that other machines can connect (can insert/update and view reports), simply i want it to be a client server application. My questions are : 1.How to configure the machine ( where the database will stay) so that others can use the databse? 2.I have used file dsn for crystal report as i want other machines to use the reports, so is it necesary for the reports to stay with each client application and also how do i find the file dsn of the machine where the database stays? 3.what will be the ado conect string for the clients to connect to the database in the lan? Regads Arunendra

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

    arunendra wrote:

    1.How to configure the machine

    Access is NOT a good shareable database. It was meant to be a Desktop database. It'll work, but you have to maintain (compact and repair) that database religously! Also, maintenance on the database will take it offline until the maintenance is complete. This means that your application cannot run until your done! This depends on your machine environment. I highly recommend reading up on Windows networking and security first. But, the basic thing is to setup a Share on the server and put your database files on that share. Then, each workstation has to map a drive to that Share. Excatly how this is done depends on if your machines are in a workgroup or domain. How you setup the Share and NTFS security also depends on this configuration.

    arunendra wrote:

    2.I have used file dsn for crystal report

    I don't use Crystal Reports, so I couldn't tell you...

    arunendra wrote:

    3.what will be the ado conect string for the clients to connect to the database in the lan?

    The same as what your using now. Only you'll have to specify the network drive letter you mapped setting up Windows networking, and specify the full path to the .MDB file. Dave Kreskowiak Microsoft MVP - Visual Basic

    A 1 Reply Last reply
    0
    • D Dave Kreskowiak

      arunendra wrote:

      1.How to configure the machine

      Access is NOT a good shareable database. It was meant to be a Desktop database. It'll work, but you have to maintain (compact and repair) that database religously! Also, maintenance on the database will take it offline until the maintenance is complete. This means that your application cannot run until your done! This depends on your machine environment. I highly recommend reading up on Windows networking and security first. But, the basic thing is to setup a Share on the server and put your database files on that share. Then, each workstation has to map a drive to that Share. Excatly how this is done depends on if your machines are in a workgroup or domain. How you setup the Share and NTFS security also depends on this configuration.

      arunendra wrote:

      2.I have used file dsn for crystal report

      I don't use Crystal Reports, so I couldn't tell you...

      arunendra wrote:

      3.what will be the ado conect string for the clients to connect to the database in the lan?

      The same as what your using now. Only you'll have to specify the network drive letter you mapped setting up Windows networking, and specify the full path to the .MDB file. Dave Kreskowiak Microsoft MVP - Visual Basic

      A Offline
      A Offline
      arunendra
      wrote on last edited by
      #3

      Thanks Dave for your reply. I know Access is not for sharing but the requirement is such that i have to use access. I have a code , therefore, in my application which will automatically run the compact database service everyday at a specific time. I actually need the code to perform what I need. for eg, if the folder in which the database resides is called "x', and the name of the mdb file is "data.mdb", then, how do I make sure that users can open from other locations, i have set read & execute,list folder contents,read, write permission for everyone and also have set the same permission for the mdb file. have i done something wrong? also i have tried the following code for connecting from the client : Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\machine_name\x\data.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" con.open connect_string but when run from another machine i get the following error msg : ( not exact!!) "the \\machine_name\x\data.mdb can not be opened as this may be not permitted or exclusively locked" Regarding the crystal report problem, i think i need to know only one thing, i.e. how to share the file dsn that i have used for the crystal report. to be specific, how should i configure the file dsn that i already have in the machine where i have the database, i think that will make the reports available in the client machines. so, can you help me for sharing the file dsn in proper manner. Regadrs Arunendra N.B. I will soon want to learn how to connect to a sql server database in a workgroup and also in a domain, i think you can help me out in that also, but currently please get me out of this. -- modified at 11:16 Friday 14th April, 2006

      D 1 Reply Last reply
      0
      • A arunendra

        Thanks Dave for your reply. I know Access is not for sharing but the requirement is such that i have to use access. I have a code , therefore, in my application which will automatically run the compact database service everyday at a specific time. I actually need the code to perform what I need. for eg, if the folder in which the database resides is called "x', and the name of the mdb file is "data.mdb", then, how do I make sure that users can open from other locations, i have set read & execute,list folder contents,read, write permission for everyone and also have set the same permission for the mdb file. have i done something wrong? also i have tried the following code for connecting from the client : Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\machine_name\x\data.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" con.open connect_string but when run from another machine i get the following error msg : ( not exact!!) "the \\machine_name\x\data.mdb can not be opened as this may be not permitted or exclusively locked" Regarding the crystal report problem, i think i need to know only one thing, i.e. how to share the file dsn that i have used for the crystal report. to be specific, how should i configure the file dsn that i already have in the machine where i have the database, i think that will make the reports available in the client machines. so, can you help me for sharing the file dsn in proper manner. Regadrs Arunendra N.B. I will soon want to learn how to connect to a sql server database in a workgroup and also in a domain, i think you can help me out in that also, but currently please get me out of this. -- modified at 11:16 Friday 14th April, 2006

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

        arunendra wrote:

        if the folder in which the database resides is called "x', and the name of the mdb file is "data.mdb", then, how do I make sure that users can open from other locations,

        Have you setup a share on folder X?? A UNC path takes the format \\machineName\shareName\folder\filename. In your case, if you create a Share on folder X and called that share "Data", then the UNC path would be \\machine_name\Data\mydata.mdb. As for the FileDSN, the default location for the file is C:\Program Files\Common Files\ODBC\Data Sources. I would suggest copying the FileDSN to that folder on each client machine. Dave Kreskowiak Microsoft MVP - Visual Basic

        A 1 Reply Last reply
        0
        • D Dave Kreskowiak

          arunendra wrote:

          if the folder in which the database resides is called "x', and the name of the mdb file is "data.mdb", then, how do I make sure that users can open from other locations,

          Have you setup a share on folder X?? A UNC path takes the format \\machineName\shareName\folder\filename. In your case, if you create a Share on folder X and called that share "Data", then the UNC path would be \\machine_name\Data\mydata.mdb. As for the FileDSN, the default location for the file is C:\Program Files\Common Files\ODBC\Data Sources. I would suggest copying the FileDSN to that folder on each client machine. Dave Kreskowiak Microsoft MVP - Visual Basic

          A Offline
          A Offline
          arunendra
          wrote on last edited by
          #5

          Thanks again for such a quick reply. First of all what is UNC? I have given permission a set of permission to that folder (x) and the mbd (data) which i have given in the earlier letter. Mostly i have given all the permissions except for the full control. do u think it will be sufficient? second, regarding file dsn, will this problem solve, if i just copy the actual dsn (say mydsn.dsn) file and paste them in each location ( the location you have given)? Or may I try using the odbc manager in each pc and just add the dsn from the remote pc? what should i do? Regards arunendra

          D 1 Reply Last reply
          0
          • A arunendra

            Thanks again for such a quick reply. First of all what is UNC? I have given permission a set of permission to that folder (x) and the mbd (data) which i have given in the earlier letter. Mostly i have given all the permissions except for the full control. do u think it will be sufficient? second, regarding file dsn, will this problem solve, if i just copy the actual dsn (say mydsn.dsn) file and paste them in each location ( the location you have given)? Or may I try using the odbc manager in each pc and just add the dsn from the remote pc? what should i do? Regards arunendra

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

            arunendra wrote:

            First of all what is UNC?

            UNC stands for Universal Naming Convention. If you sis not create a SHARE, which you have never mentioned you did, then the security setup won't make a difference. You MUST MUMST MUST MUST create a SHARE on the X folder. Right click the X folder, click on "Sharing...", then click on "Share this folder". Give the share a name... Yes, you can copy the FileDSN file over to the client workstations and it'll work. Dave Kreskowiak Microsoft MVP - Visual Basic

            A 1 Reply Last reply
            0
            • D Dave Kreskowiak

              arunendra wrote:

              First of all what is UNC?

              UNC stands for Universal Naming Convention. If you sis not create a SHARE, which you have never mentioned you did, then the security setup won't make a difference. You MUST MUMST MUST MUST create a SHARE on the X folder. Right click the X folder, click on "Sharing...", then click on "Share this folder". Give the share a name... Yes, you can copy the FileDSN file over to the client workstations and it'll work. Dave Kreskowiak Microsoft MVP - Visual Basic

              A Offline
              A Offline
              arunendra
              wrote on last edited by
              #7

              Thanks Dave. I am out of my setup and so couldnt try it, but I will follow your instructions and will report it back. In the mean while, can you help me in a very different subject, as I found this to be amazing, I never thought I will find someone who will answer my questions, and so I am bursting with all the queries, I am sorry for that , but i am trying my best to filter them and send you something that is absolutely impossible for me to do. I have a code for compacting which uses jet engine,(there was a code which was working fine but was in DAO, and I found some errors occuring in my project and also in the crystal report, so i thought of going on with ado only), the code if changed a little works fine, i dont remeber what changes i had done but it can't put the password back to the newly created mdb file, so i am sending the original code i got , please see what I have to do. ''''''''''''''''''''' the code ''''''''''''''''''''''''''''''''''''' Public Function CompactAndRepairDB(sSource As String, _ sDestination As String, _ Optional sSecurity As String, _ Optional sUser As String = "Admin", _ Optional sPassword As String, _ Optional lDestinationVersion As Long) As Boolean Dim sCompactPart1 As String Dim sCompactPart2 As String Dim oJet As JRO.JetEngine ' Put together the provider string for the source database sCompactPart1 = "Provider=Microsoft.Jet.OLEDB.4.0" & _ ";Data Source=" & sSource & _ ";User Id=" & sUser & _ ";Password=" & sPassword ' If the database has a user-level security file, add the ' details If sSecurity <> "" Then sCompactPart1 = sCompactPart1 & _ ";Jet OLEDB:System database=" & sSecurity & ";" ' Else ' sCompactPart1 = sCompactPart1 & _ ' ";Jet OLEDB:System database=false ;" End If ' Put together the provider string for the destination ' database sCompactPart2 = "Provider=Microsoft.Jet.OLEDB.4.0" & _ ";Data Source=" & sDestination & ";Persist Security Info=False;Jet OLEDB:Database Password=bill1234" ' The destination database will end up in the latest version ' of jet, unless a specific version has been requested; ' 1 = Jet 1.0, 2 = Jet 1.1, 3 = Jet 2.x, 4 = Jet 3.x, ' 5 = Jet 4.x etc If lDestinationVersion <> 0 Then sCompactPart2 = sCompactPart2 & _ ";Jet OLEDB:Engine Type=" & lDestinationVersion End If ' Compact and

              D 1 Reply Last reply
              0
              • A arunendra

                Thanks Dave. I am out of my setup and so couldnt try it, but I will follow your instructions and will report it back. In the mean while, can you help me in a very different subject, as I found this to be amazing, I never thought I will find someone who will answer my questions, and so I am bursting with all the queries, I am sorry for that , but i am trying my best to filter them and send you something that is absolutely impossible for me to do. I have a code for compacting which uses jet engine,(there was a code which was working fine but was in DAO, and I found some errors occuring in my project and also in the crystal report, so i thought of going on with ado only), the code if changed a little works fine, i dont remeber what changes i had done but it can't put the password back to the newly created mdb file, so i am sending the original code i got , please see what I have to do. ''''''''''''''''''''' the code ''''''''''''''''''''''''''''''''''''' Public Function CompactAndRepairDB(sSource As String, _ sDestination As String, _ Optional sSecurity As String, _ Optional sUser As String = "Admin", _ Optional sPassword As String, _ Optional lDestinationVersion As Long) As Boolean Dim sCompactPart1 As String Dim sCompactPart2 As String Dim oJet As JRO.JetEngine ' Put together the provider string for the source database sCompactPart1 = "Provider=Microsoft.Jet.OLEDB.4.0" & _ ";Data Source=" & sSource & _ ";User Id=" & sUser & _ ";Password=" & sPassword ' If the database has a user-level security file, add the ' details If sSecurity <> "" Then sCompactPart1 = sCompactPart1 & _ ";Jet OLEDB:System database=" & sSecurity & ";" ' Else ' sCompactPart1 = sCompactPart1 & _ ' ";Jet OLEDB:System database=false ;" End If ' Put together the provider string for the destination ' database sCompactPart2 = "Provider=Microsoft.Jet.OLEDB.4.0" & _ ";Data Source=" & sDestination & ";Persist Security Info=False;Jet OLEDB:Database Password=bill1234" ' The destination database will end up in the latest version ' of jet, unless a specific version has been requested; ' 1 = Jet 1.0, 2 = Jet 1.1, 3 = Jet 2.x, 4 = Jet 3.x, ' 5 = Jet 4.x etc If lDestinationVersion <> 0 Then sCompactPart2 = sCompactPart2 & _ ";Jet OLEDB:Engine Type=" & lDestinationVersion End If ' Compact and

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

                First, the database cannot be opened by ANYTHING. Not one of your client machines, not Access, ... NOTHING can have the database open already. Second, if there is a workgroup file for the database, it has to be in the same folder as the .MDB file. Next, we'll just simplify your code a bit:

                ' sSrcPath is the source database file path
                ' sDstPath is the source database file path
                ' sUser is the username to use to login to the source database
                ' sPassword is the sUser's password
                ' sSystemPassword is the Database Password to use to login to the source
                ' and reset in the destination databases

                Public Function CompactAndRepairDB( _
                sSrcPath As String, _
                sDstPath As String, _
                Optional sUser As String = "Admin", _
                Optional sPassword As String, _
                Optional sSystemPassword As String) _
                As Boolean
                 
                Dim srcConn As String
                srcConn = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};User Id={1};Password={2};Jet OLEDB:Database Password={3}", sSource, sUser, sPassword, sSystemPassword)
                 
                Dim dstConn As String
                dstConn = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Jet OLEDB:Engine Type=5;Jet OLEDB:Database Password={1}", sDestination, sSystemPassword)
                 
                Dim JRO As New JRO.JetEngine
                JRO.CompactDatabase(srcConn, dstConn)
                 
                Return True
                End Function

                If you wanted to use this in more applications, I'd rewrite it to be more flexible. Right now, it'll only work on databases that have a Database Password set. Oh!! Don't forget to rename the source database to a temp name and rename the destination database back to the same name as the original source!! Dave Kreskowiak Microsoft MVP - Visual Basic

                A 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  First, the database cannot be opened by ANYTHING. Not one of your client machines, not Access, ... NOTHING can have the database open already. Second, if there is a workgroup file for the database, it has to be in the same folder as the .MDB file. Next, we'll just simplify your code a bit:

                  ' sSrcPath is the source database file path
                  ' sDstPath is the source database file path
                  ' sUser is the username to use to login to the source database
                  ' sPassword is the sUser's password
                  ' sSystemPassword is the Database Password to use to login to the source
                  ' and reset in the destination databases

                  Public Function CompactAndRepairDB( _
                  sSrcPath As String, _
                  sDstPath As String, _
                  Optional sUser As String = "Admin", _
                  Optional sPassword As String, _
                  Optional sSystemPassword As String) _
                  As Boolean
                   
                  Dim srcConn As String
                  srcConn = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};User Id={1};Password={2};Jet OLEDB:Database Password={3}", sSource, sUser, sPassword, sSystemPassword)
                   
                  Dim dstConn As String
                  dstConn = String.Format("Provider=Microsoft.Jet.OLEDB.4.0;Data Source={0};Jet OLEDB:Engine Type=5;Jet OLEDB:Database Password={1}", sDestination, sSystemPassword)
                   
                  Dim JRO As New JRO.JetEngine
                  JRO.CompactDatabase(srcConn, dstConn)
                   
                  Return True
                  End Function

                  If you wanted to use this in more applications, I'd rewrite it to be more flexible. Right now, it'll only work on databases that have a Database Password set. Oh!! Don't forget to rename the source database to a temp name and rename the destination database back to the same name as the original source!! Dave Kreskowiak Microsoft MVP - Visual Basic

                  A Offline
                  A Offline
                  arunendra
                  wrote on last edited by
                  #9

                  Thanks dave! But in the code you sent string.format part is showing a compile error and the error says : "expected (" is it problem in my vb? do i have to do something to rectify this error? and also, i want everyone to open the database, ofcourse through the software so that they can insert/update/delete/select records. for that i have used following code for opening the connection : connect_string is string type data Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Flexnet\TECHNOPACK\technopack.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" con.execute str and for selecting data i have used : dim str as string str=" str="select * from Stock" set rec=nothing rec.Open str, Con, adOpenStatic, adLockOptimistic, adCmdText and for any update/delete/insert i have first built the string and then simply executed the statement by con.execute str where con is the adodb connection. for that machine where the database will reside i have used the following string : 'con is the adodb connection Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & app.path & "\TECHNOPACK\technopack.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" con.execute str Have i done something wrong? Please note that i want every pc to have the same right, so that everyone can use the database. and for the compacting the database i will provide that option only in the machine where the database will reside. and also if possible please send the compacting code you were talking about. Regadrs Arunendra -- modified at 12:11 Saturday 15th April, 2006 N.B. just now i have found something!! the code for the client doesnt run until i get into that particular machine where the database stored with a user id and password, so my question is can i integrate that machine user id and password in my code? i tried to get into the machine with the following command from the run -> \\machine_name; it asked for user id and password, i gave them and then the shared resources appeared. then i tried to open the exe and the exe worked!! so is my question! am i right?? and can this be a way of connecting in the workgroup for running my software?

                  D 1 Reply Last reply
                  0
                  • A arunendra

                    Thanks dave! But in the code you sent string.format part is showing a compile error and the error says : "expected (" is it problem in my vb? do i have to do something to rectify this error? and also, i want everyone to open the database, ofcourse through the software so that they can insert/update/delete/select records. for that i have used following code for opening the connection : connect_string is string type data Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\Flexnet\TECHNOPACK\technopack.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" con.execute str and for selecting data i have used : dim str as string str=" str="select * from Stock" set rec=nothing rec.Open str, Con, adOpenStatic, adLockOptimistic, adCmdText and for any update/delete/insert i have first built the string and then simply executed the statement by con.execute str where con is the adodb connection. for that machine where the database will reside i have used the following string : 'con is the adodb connection Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & app.path & "\TECHNOPACK\technopack.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" con.execute str Have i done something wrong? Please note that i want every pc to have the same right, so that everyone can use the database. and for the compacting the database i will provide that option only in the machine where the database will reside. and also if possible please send the compacting code you were talking about. Regadrs Arunendra -- modified at 12:11 Saturday 15th April, 2006 N.B. just now i have found something!! the code for the client doesnt run until i get into that particular machine where the database stored with a user id and password, so my question is can i integrate that machine user id and password in my code? i tried to get into the machine with the following command from the run -> \\machine_name; it asked for user id and password, i gave them and then the shared resources appeared. then i tried to open the exe and the exe worked!! so is my question! am i right?? and can this be a way of connecting in the workgroup for running my software?

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

                    arunendra wrote:

                    But in the code you sent string.format part is showing a compile error and the error says : "expected (". Is it problem in my vb? do i have to do something to rectify this error?

                    I forgot, you're using VB6. The code I posted is for VB.NET. Here's the VB6 translated portions:

                    Dim srcConn As String
                    srcConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sSource & \_
                        ";User Id=" & sUser & \_
                        ";Password=" & sPassword & \_
                        ";Jet OLEDB:Database Password=" & sSystemPassword
                    

                    Dim dstConn As String
                    dstConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sDestination & _
                    ";Jet OLEDB:Engine Type=5" & _
                    ";Jet OLEDB:Database Password=" & sSystemPassword

                    arunendra wrote:

                    N.B. just now i have found something!! the code for the client doesnt run until i get into that particular machine where the database stored with a user id and password, so my question is can i integrate that machine user id and password in my code?

                    Can it be put into the code? Yes. Is it a good idea?? HELL NO!! Don't even think of doing this! Map a drive letter to the network share before you try to launch the .EXE. The process of mapping the drive will ask for the users name and password, adding a FAR MORE MANAGEABLE layer of security to your application. If you put it in your code, your code can then NOT be transfered to another environment, being explicitly tied to this exact network setup. Not a good idea... Then, in your connection string, supply the full path to the database file using the drive letter that was mapped, i.e.: F:\Technopack.mdb. Dave Kreskowiak Microsoft MVP - Visual Basic

                    A 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      arunendra wrote:

                      But in the code you sent string.format part is showing a compile error and the error says : "expected (". Is it problem in my vb? do i have to do something to rectify this error?

                      I forgot, you're using VB6. The code I posted is for VB.NET. Here's the VB6 translated portions:

                      Dim srcConn As String
                      srcConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sSource & \_
                          ";User Id=" & sUser & \_
                          ";Password=" & sPassword & \_
                          ";Jet OLEDB:Database Password=" & sSystemPassword
                      

                      Dim dstConn As String
                      dstConn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sDestination & _
                      ";Jet OLEDB:Engine Type=5" & _
                      ";Jet OLEDB:Database Password=" & sSystemPassword

                      arunendra wrote:

                      N.B. just now i have found something!! the code for the client doesnt run until i get into that particular machine where the database stored with a user id and password, so my question is can i integrate that machine user id and password in my code?

                      Can it be put into the code? Yes. Is it a good idea?? HELL NO!! Don't even think of doing this! Map a drive letter to the network share before you try to launch the .EXE. The process of mapping the drive will ask for the users name and password, adding a FAR MORE MANAGEABLE layer of security to your application. If you put it in your code, your code can then NOT be transfered to another environment, being explicitly tied to this exact network setup. Not a good idea... Then, in your connection string, supply the full path to the database file using the drive letter that was mapped, i.e.: F:\Technopack.mdb. Dave Kreskowiak Microsoft MVP - Visual Basic

                      A Offline
                      A Offline
                      arunendra
                      wrote on last edited by
                      #11

                      Thanks Dave for your continuous support! 1.for the first part (comapcting), the string (source) now looks like the following when it is passed to the function: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=;User Id=Admin;password= ;Jet OLEDB:Database Password=bill1234 is the formation right? 2. the part : oJet.CompactDatabase(srcConn, dstConn), gives a compiler error "expected:="; if i remove the brackets, there is no error, will it work? 3. if i try like that (with out bracket and with the string formed above, and when run,when the compactdatabase part comes, the error msg occures : "object variable or with block variable not set" what shall i do? for the second part, can you build a complete connect string, for eg if the machine where the database is present is called "machine one", and the database mdb file is in the d drive of that machine (d:\datafolder\data.mdb), and if that folder is shared as "datafolder_shared", with the permission of "modify/read/execute and write" for a group of users and full control for the administrators, then what should be the string to connect from another machine : should it be something like the following : Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\machine one\datafolder_shared\data.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" or Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\machine one\datafolder_shared:\data.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" or something else? you want me to map a drive, but how to do and in which machine i have to do? i have so, given the full situation, plz tell me a bit more. I am sorry as i dont know much of computer administration, so i give you some trouble, i hope you will pull me out of this. Regards Arunendra

                      D 1 Reply Last reply
                      0
                      • A arunendra

                        Thanks Dave for your continuous support! 1.for the first part (comapcting), the string (source) now looks like the following when it is passed to the function: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=;User Id=Admin;password= ;Jet OLEDB:Database Password=bill1234 is the formation right? 2. the part : oJet.CompactDatabase(srcConn, dstConn), gives a compiler error "expected:="; if i remove the brackets, there is no error, will it work? 3. if i try like that (with out bracket and with the string formed above, and when run,when the compactdatabase part comes, the error msg occures : "object variable or with block variable not set" what shall i do? for the second part, can you build a complete connect string, for eg if the machine where the database is present is called "machine one", and the database mdb file is in the d drive of that machine (d:\datafolder\data.mdb), and if that folder is shared as "datafolder_shared", with the permission of "modify/read/execute and write" for a group of users and full control for the administrators, then what should be the string to connect from another machine : should it be something like the following : Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\machine one\datafolder_shared\data.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" or Connect_String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\\machine one\datafolder_shared:\data.mdb;Persist Security Info=False;Jet OLEDB:Database Password=bill1234" or something else? you want me to map a drive, but how to do and in which machine i have to do? i have so, given the full situation, plz tell me a bit more. I am sorry as i dont know much of computer administration, so i give you some trouble, i hope you will pull me out of this. Regards Arunendra

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

                        arunendra wrote:

                        1.for the first part (comapcting), the string (source) now looks like the following when it is passed to the function: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=;User Id=Admin;password= ;Jet OLEDB:Database Password=bill1234 is the formation right?

                        Nope. You didn't supply a path to the database you want to compact. Notice that Data Source doesn't have anything after it?

                        arunendra wrote:

                        2. the part : oJet.CompactDatabase(srcConn, dstConn), gives a compiler error "expected:="; if i remove the brackets, there is no error, will it work?

                        Remove the paranthesis and it'll work. It's been about 6 years since I've used VB6. I forgot, if your don't use the return value, you don't supply paranthesis around the arguments your passing to the function.

                        arunendra wrote:

                        3. if i try like that (with out bracket and with the string formed above, and when run,when the compactdatabase part comes, the error msg occures : "object variable or with block variable not set" what shall i do?

                        Because you didn't supply the Data Source parameter in question 1. How is it supposed to know which database to compact if that Data Source is blank???

                        arunendra wrote:

                        you want me to map a drive, but how to do and in which machine i have to do?

                        This is why I told you to read up on Windows networking before you tried this! You have to map a drive before you launch this application. This is done through login scripts or you can setup a persistant drive mapping on each client workstation, or map the drive using a batch file before the app is launched, ... Dave Kreskowiak Microsoft MVP - Visual Basic

                        A 1 Reply Last reply
                        0
                        • D Dave Kreskowiak

                          arunendra wrote:

                          1.for the first part (comapcting), the string (source) now looks like the following when it is passed to the function: Provider=Microsoft.Jet.OLEDB.4.0;Data Source=;User Id=Admin;password= ;Jet OLEDB:Database Password=bill1234 is the formation right?

                          Nope. You didn't supply a path to the database you want to compact. Notice that Data Source doesn't have anything after it?

                          arunendra wrote:

                          2. the part : oJet.CompactDatabase(srcConn, dstConn), gives a compiler error "expected:="; if i remove the brackets, there is no error, will it work?

                          Remove the paranthesis and it'll work. It's been about 6 years since I've used VB6. I forgot, if your don't use the return value, you don't supply paranthesis around the arguments your passing to the function.

                          arunendra wrote:

                          3. if i try like that (with out bracket and with the string formed above, and when run,when the compactdatabase part comes, the error msg occures : "object variable or with block variable not set" what shall i do?

                          Because you didn't supply the Data Source parameter in question 1. How is it supposed to know which database to compact if that Data Source is blank???

                          arunendra wrote:

                          you want me to map a drive, but how to do and in which machine i have to do?

                          This is why I told you to read up on Windows networking before you tried this! You have to map a drive before you launch this application. This is done through login scripts or you can setup a persistant drive mapping on each client workstation, or map the drive using a batch file before the app is launched, ... Dave Kreskowiak Microsoft MVP - Visual Basic

                          A Offline
                          A Offline
                          arunendra
                          wrote on last edited by
                          #13

                          Dear Dave! Thanks for the help. Now the source string looks like : Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\TECHNOPACK\technopack.mdb;User Id=Admin;password=;Jet OLEDB:Database Password=bill1234 and the destination string is like the following : Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\TECHNOPACK\tmptechnopack.mdb;Jet OLEDB:Engine Type=5;Jet OLEDB:Database Password=bill1234 The error was still on and after a little bit of searching i found that in my declaration of jro jetengine ,new keyword was missing, now the problem of compacting is over!!! Thanks! For windows netwroking, can you give me any good location address from where I can get more about that. I have also found that, if I try with permissions for "Everyone" (permissions to read,list,write and execute) my problem would be solved. Do you think it's a good idea? furthermore, I dont see any user with this name or any group, but this word does work! can you explain a bit! Regards arunendra N.B another thing! do you mind if I ask something else under this subject line. if yes then only i will ask. thanks again for the help. -- modified at 6:19 Monday 17th April, 2006

                          D 1 Reply Last reply
                          0
                          • A arunendra

                            Dear Dave! Thanks for the help. Now the source string looks like : Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\TECHNOPACK\technopack.mdb;User Id=Admin;password=;Jet OLEDB:Database Password=bill1234 and the destination string is like the following : Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\TECHNOPACK\tmptechnopack.mdb;Jet OLEDB:Engine Type=5;Jet OLEDB:Database Password=bill1234 The error was still on and after a little bit of searching i found that in my declaration of jro jetengine ,new keyword was missing, now the problem of compacting is over!!! Thanks! For windows netwroking, can you give me any good location address from where I can get more about that. I have also found that, if I try with permissions for "Everyone" (permissions to read,list,write and execute) my problem would be solved. Do you think it's a good idea? furthermore, I dont see any user with this name or any group, but this word does work! can you explain a bit! Regards arunendra N.B another thing! do you mind if I ask something else under this subject line. if yes then only i will ask. thanks again for the help. -- modified at 6:19 Monday 17th April, 2006

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

                            arunendra wrote:

                            I have also found that, if I try with permissions for "Everyone" (permissions to read,list,write and execute) my problem would be solved. Do you think it's a good idea?

                            Not really... Home and Small Office Networking with Windows XP[^]

                            arunendra wrote:

                            furthermore, I dont see any user with this name or any group, but this word does work! can you explain a bit!

                            What do you think "Everyone" means? It doesn't care what the username is, authenticated or otherwise.

                            arunendra wrote:

                            N.B another thing! do you mind if I ask something else under this subject line. if yes then only i will ask.

                            New line of questions = new post. Dave Kreskowiak Microsoft MVP - Visual Basic

                            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