473,327 Members | 1,936 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Splitting of a cell value

In my Application,I need to split the cell value in such a way that the each splitted values is stored as different record...
for ex-If the value in the cell A1 is (20,43,15) then it should be stored in the Database(Ms Aceess 2003) as

Record 1 :20

Record 1 :43

Record 1 :15


How to write a function in vba so as to split the cell value without using the built in option "Text to column".

Can any one Plz help me to do this...
Nov 11 '10 #1
2 1872
TheSmileyCoder
2,322 Expert Mod 2GB
Access has a built in Split function.
Asumming you have imported the date to access, in a table myTbl, with fields: Original, Field1, Field2,Field3 you could do:


Expand|Select|Wrap|Line Numbers
  1. 'Open recordset
  2.   Dim myRS as dao.Recordset
  3.   set myRs=CurrentDb.OpenRecordset("myTbl",dbopendynaset)
  4.  
  5. 'Loop through records
  6.   Do While not myRS.Eof
  7.     myRS.Edit
  8.     myRS!Field1=Split(myRS!Original,",")(0) 'Take first 
  9.     myRS!Field2=Split(myRS!Original,",")(1) 'Take second 
  10.     myRS!Field3=Split(myRS!Original,",")(2) 'Take third 
  11.     myRs.Update
  12.   Loop
  13.  
  14. 'Cleanup
  15.    myRS.Close
  16.    set myRS=Nothing
  17.  
Nov 11 '10 #2
Thanks...

This data will b in the form of different columns whereas the data to be displayed should be as

Record1-20

Record2-43

Record3-46
Nov 12 '10 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

0
by: Ryan Liu | last post by:
Hi, I want to validate the cell value before commit it -- changing the cell from edit mode(text box, DateTimePicker) to view mode. This happens when I click on other cell. Which event I can...
1
by: esroinc | last post by:
By creating an event that fires when I click on a cell, I am able to obtain the coordinates of that cell, but I have not been able to get the data or value in that cell. cellCoordinates =...
9
by: Paul | last post by:
Hi I have a data grid with a hyperlink column. the colum has numbers like 00001,000002, ect. Just wondering how to get the text value of the cell as tempstring =...
1
by: Allen Hubatka | last post by:
Is it possible to change the data grid cell value from the client side script? The cell value I am talking is not a template column. I am using .Net Framework 1.1, Vb.Net, IE5.5+ and Java script....
1
by: Jon S via DotNetMonster.com | last post by:
HI all, I'm returning a dataset to a gridview control. When the gridview asp.net control is populated from the returning dataset some of the cells remain empty. This is expected as some data...
27
by: geniet | last post by:
Hello all of you, I have some problem in setting cells values (or fromat or...) in my Excel spreadsheet using a VB statement like within my Module: Range("C1").Value = 20 I have this in a...
14
by: Mike | last post by:
I have a gridview that has a button in the last cell of each row. I want to get the text from cell 1 for that row the button was clicked on. So if my gridview looks like this: N-12 BMW ...
0
by: suresh_punniyakkodi | last post by:
Hellow Friends, I have one doubt, please help me... In Excel, i have lot of rows and coloumns, i need to read all cell values with in rows and coloumn limit... At the time...
4
by: ravir81 | last post by:
Hi, I am currently working on excel validation using Perl. I am new to Excel validation but not for Perl. I have a question regarding one of the validation. Could anyone please tell me how to get...
5
by: dave816 | last post by:
Sorry for the Excel question in an Access forum...................I don't see an Excel forum and there's probably a reason for that but figured I'd give this a shot anyway. Again sorry, delete if...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.