Question : Merging Form Fields to one column on table

I have a form that has 16 drop down boxes, these boxes contain different options based on a previous selection in the form.  Upon submit I would like whatever combo box that is not blank to submit to the Reason Column in the Table.   Any ideas on how to approach this?

Answer : Merging Form Fields to one column on table


dim ctl as control, sReason as string
for each ctl in me.controls
      if ctl.controltype=accombobox then
          if left(ctl.name,9)="SubReason" then
             if not isnull(ctl) then
                 sreason=sreason &","& ctl.value
              end if
          end if
      end if
next

if len(sreason)>0 then sreason=mid(sreason,2)

'now you can use sReason to fill the Subreason Column

dim rs as dao.recordset
currentdb.openrecordset("TableName")

rs.addnew
   rs!FieldID=
   rs! Subreason=sReason
rs.update

rs.close


Random Solutions  
 
programming4us programming4us