error during reading the names

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

    error during reading the names

    Hi!
    i made a programe in which i want to print the names but
    when the names like " Women's " which contain this " ' " sign it produces the syntax error
    how can remove this error because i have to print this name in the same way
  • QVeen72
    Recognized Expert Top Contributor
    • Oct 2006
    • 1445

    #2
    Hi,

    Do Input Validation for the TextBox.. Dont Allow User to Enter '
    Write This Code in KeyPress Event of the TextBox:

    [code=vb]
    If Chr(KeyAscii) = "'" Then KeyAscii = 0
    [/code]

    REgards
    Veena

    Comment

    • veer
      New Member
      • Jul 2007
      • 198

      #3
      Hi!
      Actually i am accessing a file which already have these name
      and through my programe i did some changing and then print all these names
      thanks


      Originally posted by QVeen72
      Hi,

      Do Input Validation for the TextBox.. Dont Allow User to Enter '
      Write This Code in KeyPress Event of the TextBox:

      [code=vb]
      If Chr(KeyAscii) = "'" Then KeyAscii = 0
      [/code]

      REgards
      Veena

      Comment

      • QVeen72
        Recognized Expert Top Contributor
        • Oct 2006
        • 1445

        #4
        Hi,

        So you are getting error in SQL Select Statement..?
        Print the Select statement here..

        REgards
        Veena

        Comment

        • veer
          New Member
          • Jul 2007
          • 198

          #5
          this is my select statement
          Select * From " & dbfname & " Where CMPNYNM='" & rsMn(0) & "'"

          THANKS
          Originally posted by QVeen72
          Hi,

          So you are getting error in SQL Select Statement..?
          Print the Select statement here..

          REgards
          Veena

          Comment

          • QVeen72
            Recognized Expert Top Contributor
            • Oct 2006
            • 1445

            #6
            Hi,

            Try this :

            [code=vb]
            sSQL = " Select * From " & dbfname & " Where CMPNYNM='" _
            & Replace(rsMn(0) ,"'","''") & "'"
            [/code]

            Regards
            Veena

            Comment

            • veer
              New Member
              • Jul 2007
              • 198

              #7
              Thanks it's working
              Yesterday i asked a question to you about comparision of two columns
              actually i want a order of data like
              company name ---------indent
              Hadley Dodd ---------- 0
              Hadley Dodd --------- D

              above example means
              i have a column contains some company names and other has some indents like 0,D,1 . Firstly the name " Hadley Dodd" with indent "0" comes and print and then if same name comes but indent should be "D" or "1" etc print and then go to next record and if the same name does't come then move to next record

              if you understand the programe then please give me some tips how i can search the columns
              thanks
              Originally posted by QVeen72
              Hi,

              Try this :

              [code=vb]
              sSQL = " Select * From " & dbfname & " Where CMPNYNM='" _
              & Replace(rsMn(0) ,"'","''") & "'"
              [/code]

              Regards
              Veena

              Comment

              • QVeen72
                Recognized Expert Top Contributor
                • Oct 2006
                • 1445

                #8
                Hi,

                I didnt understand your Problem..
                But is it that you are Looking for "Order By"..?:

                Try This :

                Select * From MyTable Order By CompName, Indent

                REgards
                Veena

                Comment

                • veer
                  New Member
                  • Jul 2007
                  • 198

                  #9
                  Hi!
                  actually i have a file in which data is randomly inserted
                  and i am accessing that file which have two columns i,e Company_Name , Indent. In company_name column one name may be repeated saveral times but with different indents like "0","D","1" , "M" etc and i want the order like i have mentioned you in previous post

                  Originally posted by QVeen72
                  Hi,

                  I didnt understand your Problem..
                  But is it that you are Looking for "Order By"..?:

                  Try This :

                  Select * From MyTable Order By CompName, Indent

                  REgards
                  Veena

                  Comment

                  • QVeen72
                    Recognized Expert Top Contributor
                    • Oct 2006
                    • 1445

                    #10
                    Hi,

                    So, is it a Text File..?
                    Means, You want To Parse a Text File..? How are the 2 Columns Seperated in the Text File ? (Any Special Characters To identify Column..?)

                    If not text file, and if it is Table, then use Select Statement (prev Post)

                    Regards
                    Veena

                    Comment

                    • veer
                      New Member
                      • Jul 2007
                      • 198

                      #11
                      No its a .dbf file
                      i think you are not understanding my programe i attach a sample of file in doc format in which two tables are made the table contained random data
                      and the second contain a order wise data


                      please check and give some idea




                      Originally posted by QVeen72
                      Hi,

                      So, is it a Text File..?
                      Means, You want To Parse a Text File..? How are the 2 Columns Seperated in the Text File ? (Any Special Characters To identify Column..?)

                      If not text file, and if it is Table, then use Select Statement (prev Post)

                      Regards
                      Veena

                      Comment

                      • QVeen72
                        Recognized Expert Top Contributor
                        • Oct 2006
                        • 1445

                        #12
                        HI,

                        If it is a dbf File, Create a Connection to DBF and Open a Recordset for the selected file...

                        or else
                        Post the code here..

                        REgards
                        Veena

                        Comment

                        Working...