Parsing a Field...

OK, now this is sure to confuse you but....
the "staff" table is where all of the original data resides, notice he only puts the hours into each field, each field is named for an employee.

Through a stored procedure, I rewrite the data into the "daily_info" table, where I also gather the pager and userid and add that too. I must rewrite the data because I need it by day, not by employee.

Then using another stored procedure I write the "daily_info" table into the "employee" table (actually 3 of them, I only attached one) where I display it into a listbox for the user to move into a corresponding office.

Then I find out that not only does the user want to see the employee, but he also wants to see his hours more clearly, than the way they are being shown in the field, this my issue..

I would love to attach the whole db, but it is linked to the sql db.
 

Attachments

Perhaps consider the VBA Split Function:

Code:
Dim MyData() As String
Dim i As Integer

MyData = [COLOR="Blue"][B]Split([/B][/COLOR]FieldString, " - "[B][COLOR="Blue"])[/COLOR][/B]

For i = LBound(MyData) To UBound(MyData)
   MsgBox MyData(i)   
Next i

See MS-Access help for more details.

(this is for your initial post by the way...)

.
 
Last edited:
I have a "thing" :D made that will do it and I just altered it for dashes. If you are an Access purist please don't read any further.:D

A table is made and the first field holds all the records for Smith - 8 - 2323 - b3234 or Jones - 98 - 2 - 2323 - b3234. Then five other fields are made. Or if there is more number groups in the string then extra fields are added

A query is made (you can have what is here if you want it) with first field being the records and the second field a Left() and the third field a Right(). Then you have the 5 ot 6 fields. Lest call these fields a, b, c, d, e and f

A runmacro that is SetValue sets the value of [a] with the results of Left() and then sets the value of the record field with the results of the Right (). It repeats that process through to [f.]

The way I have it at the moment it will have leading space before each number group. So that would be either change the Left() or Right() or just do a LTrim on the fields.

It then moves to the next record and so it goes. Have Echo Yes and turn the lights off and sit and watch.

You will now have each number group in a separate field.
 

Users who are viewing this thread

Back
Top Bottom