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 my query will only check the first characters
in the field to confirm whether they match the original split I did
with the other code I showed under VBA breakout (you'll notice I used
the code in the part I show here for part two and three of this
question - thanks Bill, much appreciated.)
Is there a way to do a comparison with Access without doing any fancy
programming? In other words, can we get it to scan for a comma then
look for the alphanums after that until the next comma and do a
comparison that way? If so, then we can dispense with questions two
and three.
The second is a problem I have with the current code at the bottom
here, I am getting a "Loop without Do" error. It was working fine
until I added the If i>...Else parts to each category field. How can
I avoid this error? Please read the third question before answering
this one, as it may solve the issue without being too messy.
The third is how can I form a small loop with this...can I use cat to
join a number after the word Category as in the following pseudo?
Loop i from 0 to 9
new first string = "category"+i
make init.new first string = strCat(i)
if i is greater than the limits of the array strCat, break
end loop
thanks for al the help.
O
Sub TableSplittingCategories()
Dim init As DAO.Recordset
Dim strCat() As String
Dim i As Integer
Set init = CurrentDb.OpenRecordset("DBTasks")
Do Until init.EOF = True
strCat = split(init!Categories, ",")
init.AddNew
i = 0
init!Category0 = strCat(i)
i = i + 1
If i UBound(strCat) Then
init.Update
Exit Do
Else
init!Category1 = strCat(i)
i = i + 1
If i UBound(strCat) Then
init.Update
Exit Do
Else
init!Category2 = strCat(i)
i = i + 1
If i UBound(strCat) Then
init.Update
Exit Do
Else
init!Category3 = strCat(i)
i = i + 1
If i UBound(strCat) Then
init.Update
Exit Do
Else
init.Update
init.MoveNext
Loop
End Sub