![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
I have files that are too big for excel to manipulate and need help breakin g down the data in access. Below is a sample of 3 lines of data for simplic ity ACK_ID Benefit_Code A1 1A1G1H1I3D A2 2E2F2G2J2K3D3H2T A3 For every ACK ID I need to create a separate/additional record for Each Ben efit_Code, each benefit code is 2 chars and there can be either no codes ar e several for each ACK_ID. For the example above A1 would have 5 rows, A2 w ould have 8 and A3 none. If anyone could help, it would really be appreciat ed. |
#3
| |||
| |||
|
#4
| |||
| |||
|
I already have a table that describes all of the types of benefit codes another that has more detailed information on the ACK_ID. My main problem isCreating 5 rows for ACKID A1 and 8 seperate rows for ACKID A2. I dont knowhow to create a function that can loop through a string ex "2E2F2G2J2K3D3H2T") and can create 8 different rows like belowACKID *Benefit_Code A2 * * 2E A2 * * 2F A2 * * 2G ... A2 * * 3D A2 * * 2T Thanks for the help |
#5
| |||
| |||
|
|
On Jan 9, 5:05*pm, Andrew Swartz <andrewcswa... (AT) gmail (DOT) com> wrote: I already have a table that describes all of the types of benefit codes a nother that has more detailed information on the ACK_ID. My main problem is Creating 5 rows for ACKID A1 and 8 seperate rows for ACKID A2. I dont know how to create a function that can loop through a string ex "2E2F2G2J2K3D3 H2T") and can create 8 different rows like belowACKID *Benefit_Code A2 * * 2E A2 * * 2F A2 * * 2G ... A2 * * 3D A2 * * 2T Thanks for the help You wrote A1 1A1G1H1I3D A2 2E2F2G2J2K3D3H2T And then start talking about 5 times and 8 times and it comes out confusing. The codes mean nothing to us. We aren't in the next cube over. So if I got the concept wrong, C'est la vie. Below is aircode. You pass your codes; 1A1G1H1I3D or A2E2F2G2J2K3D3H2T to the routine. Based on the length of the values passed and divided by 2 it adds records. Public Sub HowManyTimes(varValue As Variant, varKey As Variant) Dim intFor As Integer 'loop counter. Assumes 2 letter increments Dim strCode As String Dim rst As Recordset Set rst = CurrentDb.OpenRecordset("AddSomeRecs", dbOpenDynaset) If Not IsNull(varValue) Then For intFor = 1 To Len(varValue) Step 2 strCode = Mid(varValue, infFor, 2) rst.AddNew rst!ForeignKey = varKey 'field you link on rst!Field1 = Date 'update, pass fields you need to sub rst.TwoLetterCode = strCode rst.Update Next End If rst.Close Set rst = Nothing End Sub |
![]() |
| Thread Tools | |
| Display Modes | |
| |