I have jsut been given a flat file that has come out of one of our other system that has come out in a mess.
I have tidied it up to stage where it looks like
Code --- Address
01 --- address1
01 --- address2
01 ---- town
02----address1 etc
(The number of address lines can vary)
I am trying to get this into a table as per one would normally record this information
code--address1--address2...
Here's what I've maanged so far. I haven't incldued my attempt at an array as it was so far wrong!
I have tidied it up to stage where it looks like
Code --- Address
01 --- address1
01 --- address2
01 ---- town
02----address1 etc
(The number of address lines can vary)
I am trying to get this into a table as per one would normally record this information
code--address1--address2...
Here's what I've maanged so far. I haven't incldued my attempt at an array as it was so far wrong!
Code:
Set db = CurrentDb
Set rst = db.OpenRecordset("SupplierAddress", dbOpenDynaset)
Set rstNew = db.OpenRecordset("Table1", dbOpenDynaset)
' table1 has columns code, field1, field2, field3 - 6
With rst
.MoveFirst
strCode = !suppcode
Do Until .EOF
i = 0
Do Until strCode <> !suppcode
'keep adding columns until the code chanes, then need a new row
.Edit
i = i + 1
rstNew!Field(1) = !Address
' in a hope that the first line will go into column1 and so on
.MoveNext
Loop
rstNew!Code = strCode
.Update
.MoveNext
Loop
End With
Last edited: