Erika,
Just for grins I decided to try and implement your snippet into one of my applications. It works absolutely perfectly. (Not that I doubted it for a moment). For the most part I understand exactly what is happening. My one dilemma is I See the numbers being appended to the eventtype element when I run the application. What I do not understand is exactly what part is handling the return of the updated data to the element. I see for example vVal = "Sleep" + @Str(vSleepCnt) but I was expecting to need to add something like Eventid = vVal. I figure this FormFieldValue("events", "eventtype", vLoop, vVal) vLoop = vLoop + 1 is the line doing the updating but am not 100 percent sure.
This is the code I am using that works well. I tried documenting what is happening as it runs. The temporary writeln() help to see whats happening.
Could you please explain how the eventtype value is being updated.
Thanks. (I bet when you decided to create software you never realized you were going to have to be a teacher of programming at the same time

)
// Here I am declaring my variables
var vsleepCnt as Int
var vDmeCnt as Int
var vMiscCnt as Int
var vTotal as Int
var vLoop as Int
var vVal as String
// This is triggering my event (when all subform event timming is corrected this is
// probably not needed
If EventType = "" and neweventtrigger = "S"
then
{
// stoping event from running again undesired.
neweventtrigger = "c"
// capturing eventtype choice
eventtype = @PopupMenu("Sleep;DME;Misc","Please Select Event Type")
writeln(" capturing eventtype choice = " + eventtype)
//resetting counters
vSleepCnt = 0
vDmeCnt = 0
vMiscCnt = 0
vLoop = 1
vTotal = @FormResultSetTotal("events") // counting amount of lines
writeln("vtotal counting amount of lines = "+ vtotal)
// telling it to run until all lines are counted
While(vLoop <= vTotal) // telling it to run until all lines are counted
{
vVal = @FormFieldValue("events", "eventtype", vLoop)
If @Left(vVal, 5) = "Sleep"
{
vSleepCnt = vSleepCnt + 1
vVal = "Sleep" + @Str(vSleepCnt)
writeln("vval of sleep = "+ vval)
}
Else If @Left(vVal, 3) = "Dme"
{
vDmeCnt = vDmeCnt + 1
vVal = "Dme" + @Str(vDmeCnt)
writeln("vval of dme = "+ vval)
}
Else If @Left(vVal, 4) = "Misc"
{
vMiscCnt = vMiscCnt + 1
vVal = "Misc" + @Str(vMiscCnt)
writeln("vval of misc = "+ vval)
}
// is this returning the value to each element?
FormFieldValue("events", "eventtype", vLoop, vVal) vLoop = vLoop + 1
writeln("vloop of last if = "+ vloop)
}
}