2 Replies - 87 Views - Last Post: 15 March 2019 - 04:36 AM Rate Topic: -----

#1 dpointer   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 31
  • Joined: 06-March 09

How to separate alphabet and number from alphanumeric text in vb.net

Posted 15 March 2019 - 03:44 AM

I have an ms access database with table named "pop" and inside the table there are 3 columns, the first column named "itemnumber" which contains alphabet and numbers (e.g. sdfddf-12454), the second column named "itemalphabet", and the third column named "itemnumeric". The "itemalphabet" column will be the destination for the extracted alphabets and other characters from column "itemnumber" (e.g.sdfddf-) and the "itemnumeric" column will be the destination for the extracted numbers from column "itemnumber" (e.g.12454). I have 1 button named "separate" that will perform the code for separation.

Expected output illustration when the button separate is clicked:

| itemnumber | itemalphabet | itemnumeric |
|-------------------------------------------
|sdfddf-12454 | sdfddf- | 12454
|asddfs*7822 | asddfs* | 7822


Here is my code for copying all alphabet and other characters into column named "itemalphabet":

 
        psipopconnection()
        psipoprec = New ADODB.Recordset

        With psipoprec
            .Open("update  pop set itemalphabet=([itemno] ,'(?:[0-9]+\.?[0-9]*|\.[0-9]+)')", psipopcon, 2, 3)

            .Update()
        End With 



Here is also my code for copying all numbers into column named "itemnumeric":

 psipopconnection()
        psipoprec = New ADODB.Recordset

        With psipoprec
            .Open("update  pop set itemnumeric=([itemno], '(-\D)')", psipopcon, 2, 3)

            .Update()
        End With 



The codes above are getting error. What should I do? How to put the code properly in order to copy numbers or alphabet?
Please help me. Thank you

Is This A Good Question/Topic? 0
  • +

Replies To: How to separate alphabet and number from alphanumeric text in vb.net

#2 andrewsw   User is offline

  • Stealth IT
  • member icon

Reputation: 6737
  • View blog
  • Posts: 27,741
  • Joined: 12-December 12

Re: How to separate alphabet and number from alphanumeric text in vb.net

Posted 15 March 2019 - 04:21 AM

What errors are you getting?
Was This Post Helpful? 0
  • +
  • -

#3 andrewsw   User is offline

  • Stealth IT
  • member icon

Reputation: 6737
  • View blog
  • Posts: 27,741
  • Joined: 12-December 12

Re: How to separate alphabet and number from alphanumeric text in vb.net

Posted 15 March 2019 - 04:36 AM

You have switched from itemnumber to itemno.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1