network or disk error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • veer
    New Member
    • Jul 2007
    • 198

    network or disk error

    hello expert
    i have an error network or disk erro when i accessed the foxpro file
    and made another foxpro file


    actually i am accessing a .dbf file and make modification through my programe and after modification the new file should be in .dbf but it generates the above error and when i access the same file and convert it into .rtf format it works


    please provide some help
  • debasisdas
    Recognized Expert Expert
    • Dec 2006
    • 8119

    #2
    How are you trying to access the file ?

    Comment

    • veer
      New Member
      • Jul 2007
      • 198

      #3
      ya i am accessing a dbf file


      Originally posted by debasisdas
      How are you trying to access the file ?

      Comment

      • debasisdas
        Recognized Expert Expert
        • Dec 2006
        • 8119

        #4
        Are you accessing that file through VB 6.0 ???

        Comment

        • veer
          New Member
          • Jul 2007
          • 198

          #5
          YES I AM ACCESSING THE FILE THROUGH VB 6.0
          THE CODE IS USED FOR OPENING AND CREATING THE FILE IS

          [CODE=vb]Set dbMn = Workspaces(0).O penDatabase(dbf path & "\", False, False, "dBase IV")
          Set rsMn = dbMn.OpenRecord set("select * from " & dbfname)
          txtpth = dbfpath & "\" & Replace(UCase(d bfname), ".DBF", ".MDB")
          Open txtpth For Output As #1[/CODE]


          Originally posted by debasisdas
          Are you accessing that file through VB 6.0 ???
          Last edited by Killer42; Feb 14 '08, 06:10 AM. Reason: Added CODE=vb tag

          Comment

          • Killer42
            Recognized Expert Expert
            • Oct 2006
            • 8429

            #6
            Originally posted by veer
            [CODE=vb]Set dbMn = Workspaces(0).O penDatabase(dbf path & "\", False, False, "dBase IV")
            Set rsMn = dbMn.OpenRecord set("select * from " & dbfname)
            txtpth = dbfpath & "\" & Replace(UCase(d bfname), ".DBF", ".MDB")
            Open txtpth For Output As #1[/CODE]
            I have a few questions. I'm not familiar with using FoxPro from VB, so excuse me if they don't make sense.
            • Most importantly, which line produces the error?
            • Why are you trying (in line 4) to open an MDB file to write like a text file? That can't be a good idea.
            • Is the OpenDatabase method supposed to receive a folder as the first parameter, or the actual name of the DBF file?

            Comment

            • veer
              New Member
              • Jul 2007
              • 198

              #7
              actually i am not going to make mdb file , i want to access dbf file and also create a new dbf file code looks like this
              [code=vb]
              Set dbMn = Workspaces(0).O penDatabase(dbf path & "\", False, False, "dBase IV")
              Set rsMn = dbMn.OpenRecord set("select * from " & dbfname)
              txtpth = dbfpath & "\" & Replace(UCase(d bfname), ".DBF", "as.dbf")
              Open txtpth For Output As #1
              [/code]
              some time it produces the error at 2nd line "network or disk error"
              and if i put some name like "as.dbf" it works but when i will open it in foxpro it shows that not a database file

              thanks

              Originally posted by Killer42
              I have a few questions. I'm not familiar with using FoxPro from VB, so excuse me if they don't make sense.
              • Most importantly, which line produces the error?
              • Why are you trying (in line 4) to open an MDB file to write like a text file? That can't be a good idea.
              • Is the OpenDatabase method supposed to receive a folder as the first parameter, or the actual name of the DBF file?
              Last edited by debasisdas; Feb 14 '08, 09:11 AM. Reason: added code=vb tags

              Comment

              • QVeen72
                Recognized Expert Top Contributor
                • Oct 2006
                • 1445

                #8
                Hi,

                Yes, when you are working with .dbf in DAO, you get this error.
                Whatever Objects (Database, RecordSets, TableDefs, Fields) you Open, Make sure after the usage, you explicitly close them.

                RST.Close
                TD.Close
                DB.Close

                Otherwise, you keep getting this error.
                Read this :


                Regards
                Veena
                Last edited by Killer42; Feb 14 '08, 10:23 PM. Reason: Activate link

                Comment

                • Killer42
                  Recognized Expert Expert
                  • Oct 2006
                  • 8429

                  #9
                  Originally posted by veer
                  actually i am not going to make mdb file , i want to access dbf file and also create a new dbf file code looks like this
                  [code=vb]
                  Set dbMn = Workspaces(0).O penDatabase(dbf path & "\", False, False, "dBase IV")
                  Set rsMn = dbMn.OpenRecord set("select * from " & dbfname)
                  txtpth = dbfpath & "\" & Replace(UCase(d bfname), ".DBF", "as.dbf")
                  Open txtpth For Output As #1[/code]
                  some time it produces the error at 2nd line "network or disk error"
                  and if i put some name like "as.dbf" it works but when i will open it in foxpro it shows that not a database file
                  I'm really confused about what you're doing here. It sounds as though you are mixing up database files with text files. If you use an Open ... For Output as in line 4 and write stuff to the file, I don't believe you will be able to subsequently access it as a dBase file. This may well be the cause of the "network or disk error" when trying to read the database table.

                  To write information to a database file/table, you need to use the database interface, the same as when you read it.

                  Comment

                  Working...