Hello,
I am working on a query in Access 2003. I have multiple rows of data like below:
Ord # date description time
1 11/7/06 chocolate 01:00,09:00,18:00
Is there a way in Access to have the information under time split into another field if there is a comma after the number?
Possibly have the times after the first time in the column split into time1, time2, (or more if there are more times) having the times move into a new column if there are more than one time in the field?
I hope that makes sense.
Thanks,
Cynthia
2 1766
Do you mean to actually change the way the data is stored in your table, or do you just want to look at it a different way?
MMcCarthy 14,534
Recognized Expert Moderator MVP
Create new table as follows: tblTime
TimeValue (Text Datatype)
Ord # (Foreign Key Ref to other table)
Set up a fully cascading relationship between this table and your original table on [Ord#].
You will need to put this function in a module and call in somewhere in form code. Set up a dummy form with a command button if no code available. Make your query the record source of the form and put the Time field on the form and call it txtTime. You will also need to put the [Ord#] field on the form. See underneath for command button code. -
-
Function splitTimes(strTime As String, orderNo As Long)
-
Dim x As Variant
-
Dim i As Long
-
-
x = Split(strTime, ",")
-
For i = 0 To UBound(x)
-
DoCmd.RunSQL "INSERT INTO tblTime (TimeValue, [Ord#]) " & _
-
"VALUES ('" & x(i) & "'," & OrderNo & ");"
-
Next i
-
-
End Sub
-
-
To call the function... -
-
Private Sub CommandButtonName_OnClick()
-
Dim rs As Recordset
-
-
Set rs=Me.RecordsetClone
-
-
rs.MoveFirst
-
Do Until rs.EOF
-
splitTimes(Me.txtTime, Me.[Ord#])
-
rs.MoveNext
-
Loop
-
-
rs.Close
-
Set rs = Nothing
-
-
End Sub
-
-
Hello,
I am working on a query in Access 2003. I have multiple rows of data like below:
Ord # date description time
1 11/7/06 chocolate 01:00,09:00,18:00
Is there a way in Access to have the information under time split into another field if there is a comma after the number?
Possibly have the times after the first time in the column split into time1, time2, (or more if there are more times) having the times move into a new column if there are more than one time in the field?
I hope that makes sense.
Thanks,
Cynthia
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Angelo Secchi |
last post by:
Hi,
I have string of numbers and words like
',,,,,,23,,,asd,,,,,"name,surname",,,,,,,\n'
and I would like to split (I'm using string.split()) it using comma as
separator but I do not want to...
|
by: qwweeeit |
last post by:
Hi all,
I am writing a script to visualize (and print)
the web references hidden in the html files as:
'<a href="web reference"> underlined reference</a>'
Optimizing my code, I found that an...
|
by: Earl Anderson |
last post by:
I have imported an Excel worksheet into A97/WinXPH which had the new
employees names in one field ( in a Last Name,First Name
configuration). I wanted to split that one field ( ) into two...
|
by: Gary Lynch |
last post by:
I am looking for a simple solution to a recurrent problem
with imported data in Access 97. The example below is a
simplification of a problem with a much larger database.
Let's say I start out...
|
by: JeffM |
last post by:
Quick C# question:
I have comma delimited values in a string array that I want to pass to
seperate variables. Any tips on splitting the array?
Thanks in advance!
JM
| |
by: Trint Smith |
last post by:
Ok,
My program has been formating .txt files for input into sql server and
ran into a problem...the .txt is an export from an accounting package
and is only supposed to contain comas (,) between...
|
by: Opettaja |
last post by:
I am new to c# and I am currently trying to make a program to retrieve
Battlefield 2 game stats from the gamespy servers. I have got it so I
can retrieve the data but I do not know how to cut up...
|
by: sadiewms |
last post by:
Hello!
I have a flat file that I'm trying to get into a relational Access 2003
DB. One of the fields in the flat file has a list of names separated
by ";". I'd like to loop through them and...
|
by: Matt |
last post by:
Hi,
I'm ridiculously new to Access (about a week!) so please be patient!
My database is a record of British Standards. Each has a unique
identifier. Some are split into parts. I would like...
|
by: The Facilitator |
last post by:
Well, Outlook seems to be making my life more and more challenging.
Categories are added in one field and are delimmited via comma. Have
three questions on this one...
The first is right now...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
| |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...
| |