po*******@gmail.com wrote:
What do you mean by Split ?
Your design is a little off, although I guess you could use InStr() to
figure out if a value was in your list.
Split is a VB function. Open up a code module, go to help (F1) and
read all about it. It will basically take a delimited string and turn
it into an array.
e.g., varNumbers=Split("One, Two, Three",",") would return:
varNumbers(0)=1, varNumbers(1)=2, varNumbers(2)=3
so then I could just iterate through the subscripts and write
them to a table.
IF your list is comma-delimited, you should be able to do something
like
Sub NormalizeIngredientList(byval strIngredientList as string)
dim varIngredients as Variant
'--will return an array of ingredients
varIngredients=Split(strIngredientList,",")
'---loop through the ingredients that are now in the array,
varIngredients
'---lbound() returns the lowest subscript in the array, and
ubound() returns the highest.
for intCounter=lbound(varIngredients) to ubound(varIngredients)
'---write the values to a child table
strSQL="INSERT INTO RecipeChild(RecipeID, IngredientID)
VALUES (" & Me.Controls("txtRecipeID"),varIngredients(intCount er) & ")"
DBEngine(0)(0).Execute strSQL, dbFailOnError
next intCounter
End Sub