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. deleting the repeated record from a particular field

deleting the repeated record from a particular field

Scheduled Pinned Locked Moved Visual Basic
helplearning
10 Posts 4 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.
  • D Offline
    D Offline
    dennymw
    wrote on last edited by
    #1

    hello all, I need a help in VBA, I have table in my MS access, with two fields, name and items eg : Name items Ram | Book Ram | Pen Ram | Pencil Raja | Book I want to delete a particular rowfield from my table if the data repeats. After deleting, i want the table to be like Ram | Book | Pen | Pencil Raj | Book i dont want to repeat Ram hope my doubt is clear

    N F 2 Replies Last reply
    0
    • D dennymw

      hello all, I need a help in VBA, I have table in my MS access, with two fields, name and items eg : Name items Ram | Book Ram | Pen Ram | Pencil Raja | Book I want to delete a particular rowfield from my table if the data repeats. After deleting, i want the table to be like Ram | Book | Pen | Pencil Raj | Book i dont want to repeat Ram hope my doubt is clear

      N Offline
      N Offline
      Nanda_MR
      wrote on last edited by
      #2

      Actually u don't want display the ram repeatedly use SQL query Union, Union all, minus. or you can use condition and remove the name or same records.

      D 1 Reply Last reply
      0
      • N Nanda_MR

        Actually u don't want display the ram repeatedly use SQL query Union, Union all, minus. or you can use condition and remove the name or same records.

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

        Can i update 2nd and third ram with some particular value

        N L 2 Replies Last reply
        0
        • D dennymw

          Can i update 2nd and third ram with some particular value

          N Offline
          N Offline
          Nanda_MR
          wrote on last edited by
          #4

          Ya u can do it in 2 ways 1.permanently or 2.temp. 1. Update the database record using update statement. 2. use Condition statement replace value in front end.

          1 Reply Last reply
          0
          • D dennymw

            Can i update 2nd and third ram with some particular value

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

            You can use Update query i which u can set value. Like : Update table Set Name = "Demo" where Class = "null"; Regard Anubhava Dimri

            mailto: anubhava.prodata@gmail.com

            D 1 Reply Last reply
            0
            • L Lost User

              You can use Update query i which u can set value. Like : Update table Set Name = "Demo" where Class = "null"; Regard Anubhava Dimri

              mailto: anubhava.prodata@gmail.com

              D Offline
              D Offline
              dennymw
              wrote on last edited by
              #6

              Thanks friends... but if i use the update command, all the three ram is replaced with some particular value. i want to retain first Ram just want replace second and third with some value or with blank space. How to do these.

              N 1 Reply Last reply
              0
              • D dennymw

                Thanks friends... but if i use the update command, all the three ram is replaced with some particular value. i want to retain first Ram just want replace second and third with some value or with blank space. How to do these.

                N Offline
                N Offline
                Nanda_MR
                wrote on last edited by
                #7

                In where class use the more then one condition like where name='Ram' and age=20; like then that record only updated. Ananda.

                D 1 Reply Last reply
                0
                • N Nanda_MR

                  In where class use the more then one condition like where name='Ram' and age=20; like then that record only updated. Ananda.

                  D Offline
                  D Offline
                  dennymw
                  wrote on last edited by
                  #8

                  Sorry for disturbing. My table name is General Issue table and the two fields are TestCaseName and TestScriptName. In TestCaseName column some testcases are same. i just want only one entry for particular test case. The code i using is, rs.Open "SELECT TestCaseName FROM [General Issue table]", oConnection Do While (rs.EOF = False) varTestCaseName_Repeat = rs.Fields(0).Value rs.MoveNext If (varTestCaseName_Repeat = rs.Fields(0)) Then "here how to use update statement" End If Loop

                  N 1 Reply Last reply
                  0
                  • D dennymw

                    hello all, I need a help in VBA, I have table in my MS access, with two fields, name and items eg : Name items Ram | Book Ram | Pen Ram | Pencil Raja | Book I want to delete a particular rowfield from my table if the data repeats. After deleting, i want the table to be like Ram | Book | Pen | Pencil Raj | Book i dont want to repeat Ram hope my doubt is clear

                    F Offline
                    F Offline
                    fego ogwara
                    wrote on last edited by
                    #9

                    TO DELTE THAT RECORD WHAT U NEED DO IS TO SET UR DATABASE IN ORDER NOT TO REPEAT A NAME. FOR INSTANCE IF U ARE USING ADODC CONTROL THE CODE WILL BE LIKE THESE DIM RS AS NEW ADODB.RECORDSET DIM CN AS NEW ADODB.CONNECTION CN.CONNECTIONSTRING ="DATABASE PATH" CN.OPEN RS.OPEN "DELETE * FROM TABLENAME WHERE FIELDNAME='" & NAME & "'",CN

                    1 Reply Last reply
                    0
                    • D dennymw

                      Sorry for disturbing. My table name is General Issue table and the two fields are TestCaseName and TestScriptName. In TestCaseName column some testcases are same. i just want only one entry for particular test case. The code i using is, rs.Open "SELECT TestCaseName FROM [General Issue table]", oConnection Do While (rs.EOF = False) varTestCaseName_Repeat = rs.Fields(0).Value rs.MoveNext If (varTestCaseName_Repeat = rs.Fields(0)) Then "here how to use update statement" End If Loop

                      N Offline
                      N Offline
                      Nanda_MR
                      wrote on last edited by
                      #10

                      Use this.

                      Dim Str As String
                      rs.Open "SELECT TestCaseName FROM [General Issue table]", oConnection
                      Do While (rs.EOF = False)
                      varTestCaseName_Repeat = rs.Fields(0).Value
                      rs.MoveNext
                      If (varTestCaseName_Repeat = rs.Fields(0)) Then
                      Str= "UPDATE TestCaseName SET name='" & value1 & "', age=" & value2 & " WHERE name='" & rs.Fields(0) & "' And age=" & rs.Fields(1) & ";"
                      rs.Open Str, oConnection
                      End If
                      Loop

                      Ananda

                      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