the form has fields called txtFunc01 to txtFunc08.
the table on the other hand has a field called FunctionCode which takes the name selected in each of the fields txtFunc() and makes a record for each one. This may be too much information but here is the code below to save tblfunction data from the form.
Public Sub saveCurrentFunctions(ByVal pobjForm As Object, pID As String)
Dim frmObject As Object
Dim frmObject2 As Object
Dim frmObject3 As Object
Dim frmObject4 As Object
Dim frmObject5 As Object
Dim frmObject6 As Object
Dim frmObject7 As Object
Dim frmObject8 As Object
Dim frmObject9 As Object
Dim frmObject10 As Object
Dim frmObject11 As Object
Dim frmObject12 As Object
Dim frmObject13 As Object
Dim frmObject14 As Object
Dim frmObject15 As Object
Dim frmObject16 As Object
Dim frmObject17 As Object
Dim frmObject18 As Object
Dim frmObject19 As Object
Dim frmObject20 As Object
Dim frmObject21 As Object
Dim frmObject22 As Object
Dim frmObject23 As Object
Dim frmObject24 As Object
Dim frmObject25 As Object
Dim frmObject26 As Object
Dim frmObject27 As Object
Dim frmObject28 As Object
Dim sQuery As String
Dim iRow As Integer
Dim sIndex As String
Dim sFunctionCode As String
Dim sFunctionVal As String
Dim sjan2006 As String
Dim sfeb2006 As String
Dim smar2006 As String
Dim sapr2006 As String
Dim smay2006 As String
Dim sjun2006 As String
Dim sjul2006 As String
Dim saug2006 As String
Dim ssep2006 As String
Dim soct2006 As String
Dim snov2006 As String
Dim sdec2006 As String
Dim sjan2007 As String
Dim sfeb2007 As String
Dim smar2007 As String
Dim sapr2007 As String
Dim smay2007 As String
Dim sjun2007 As String
Dim sjul2007 As String
Dim saug2007 As String
Dim ssep2007 As String
Dim soct2007 As String
Dim snov2007 As String
Dim sdec2007 As String
Dim spast As String
Dim sfuture As String
On Error GoTo ErrorHandler
Set mobjForm = pobjForm
sQuery = "DELETE FROM ProjectFunction " & _
"WHERE ProjectFunction.internalProjectID = " & pID
CurrentDb.Execute sQuery
' Initialize iRow
iRow = 1
Do While (iRow <= 10)
If iRow < 10 Then
sIndex = "0" & iRow
Else
sIndex = iRow
End If
For Each frmObject In mobjForm
If (InStr(1, frmObject.ControlName, "txtFuncCode" & sIndex) > 0) Then
If Not IsNull(frmObject.Value) Then
sFunctionCode = frmObject.Value
Else
sFunctionCode = ""
End If
For Each frmObject2 In mobjForm
If (InStr(1, frmObject2.ControlName, "txtFuncVal" & sIndex) > 0) Then
If Not IsNull(frmObject2.Value) Then
sFunctionVal = frmObject2.Value
Else
sFunctionVal = ""
End If
For Each frmObject3 In mobjForm
If (InStr(1, frmObject3.ControlName, "txtjan2006" & sIndex) > 0) Then
If Not IsNull(frmObject3.Value) Then
sjan2006 = frmObject3.Value
Else
sjan2006 = "000"
End If
For Each frmObject4 In mobjForm
If (InStr(1, frmObject4.ControlName, "txtfeb2006" & sIndex) > 0) Then
If Not IsNull(frmObject4.Value) Then
sfeb2006 = frmObject4.Value
Else
sfeb2006 = "000"
End If
For Each frmObject5 In mobjForm
If (InStr(1, frmObject5.ControlName, "txtmar2006" & sIndex) > 0) Then
If Not IsNull(frmObject5.Value) Then
smar2006 = frmObject5.Value
Else
smar2006 = "000"
End If
For Each frmObject6 In mobjForm
If (InStr(1, frmObject6.ControlName, "txtapr2006" & sIndex) > 0) Then
If Not IsNull(frmObject6.Value) Then
sapr2006 = frmObject6.Value
Else
sapr2006 = "000"
End If
For Each frmObject7 In mobjForm
If (InStr(1, frmObject7.ControlName, "txtmay2006" & sIndex) > 0) Then
If Not IsNull(frmObject7.Value) Then
smay2006 = frmObject7.Value
Else
smay2006 = "000"
End If
For Each frmObject8 In mobjForm
If (InStr(1, frmObject8.ControlName, "txtjun2006" & sIndex) > 0) Then
If Not IsNull(frmObject8.Value) Then
sjun2006 = frmObject8.Value
Else
sjun2006 = "000"
End If
For Each frmObject9 In mobjForm
If (InStr(1, frmObject9.ControlName, "txtjul2006" & sIndex) > 0) Then
If Not IsNull(frmObject9.Value) Then
sjul2006 = frmObject9.Value
Else
sjul2006 = "000"
End If
For Each frmObject10 In mobjForm
If (InStr(1, frmObject10.ControlName, "txtaug2006" & sIndex) > 0) Then
If Not IsNull(frmObject10.Value) Then
saug2006 = frmObject10.Value
Else
saug2006 = "000"
End If
For Each frmObject11 In mobjForm
If (InStr(1, frmObject11.ControlName, "txtsep2006" & sIndex) > 0) Then
If Not IsNull(frmObject11.Value) Then
ssep2006 = frmObject11.Value
Else
ssep2006 = "000"
End If
For Each frmObject12 In mobjForm
If (InStr(1, frmObject12.ControlName, "txtoct2006" & sIndex) > 0) Then
If Not IsNull(frmObject12.Value) Then
soct2006 = frmObject12.Value
Else
soct2006 = "000"
End If
For Each frmObject13 In mobjForm
If (InStr(1, frmObject13.ControlName, "txtnov2006" & sIndex) > 0) Then
If Not IsNull(frmObject13.Value) Then
snov2006 = frmObject13.Value
Else
snov2006 = "000"
End If
For Each frmObject14 In mobjForm
If (InStr(1, frmObject14.ControlName, "txtdec2006" & sIndex) > 0) Then
If Not IsNull(frmObject14.Value) Then
sdec2006 = frmObject14.Value
Else
sdec2006 = "000"
End If
For Each frmObject15 In mobjForm
If (InStr(1, frmObject15.ControlName, "txtjan2007" & sIndex) > 0) Then
If Not IsNull(frmObject15.Value) Then
sjan2007 = frmObject15.Value
Else
sjan2007 = "000"
End If
For Each frmObject16 In mobjForm
If (InStr(1, frmObject16.ControlName, "txtfeb2007" & sIndex) > 0) Then
If Not IsNull(frmObject16.Value) Then
sfeb2007 = frmObject16.Value
Else
sfeb2007 = "000"
End If
For Each frmObject17 In mobjForm
If (InStr(1, frmObject17.ControlName, "txtmar2007" & sIndex) > 0) Then
If Not IsNull(frmObject17.Value) Then
smar2007 = frmObject17.Value
Else
smar2007 = "000"
End If
For Each frmObject18 In mobjForm
If (InStr(1, frmObject18.ControlName, "txtapr2007" & sIndex) > 0) Then
If Not IsNull(frmObject18.Value) Then
sapr2007 = frmObject18.Value
Else
sapr2007 = "000"
End If
For Each frmObject19 In mobjForm
If (InStr(1, frmObject19.ControlName, "txtmay2007" & sIndex) > 0) Then
If Not IsNull(frmObject19.Value) Then
smay2007 = frmObject19.Value
Else
smay2007 = "000"
End If
For Each frmObject20 In mobjForm
If (InStr(1, frmObject20.ControlName, "txtjun2007" & sIndex) > 0) Then
If Not IsNull(frmObject20.Value) Then
sjun2007 = frmObject20.Value
Else
sjun2007 = "000"
End If
For Each frmObject21 In mobjForm
If (InStr(1, frmObject21.ControlName, "txtjul2007" & sIndex) > 0) Then
If Not IsNull(frmObject21.Value) Then
sjul2007 = frmObject21.Value
Else
sjul2007 = "000"
End If
For Each frmObject22 In mobjForm
If (InStr(1, frmObject22.ControlName, "txtaug2007" & sIndex) > 0) Then
If Not IsNull(frmObject22.Value) Then
saug2007 = frmObject22.Value
Else
saug2007 = "000"
End If
For Each frmObject23 In mobjForm
If (InStr(1, frmObject23.ControlName, "txtsep2007" & sIndex) > 0) Then
If Not IsNull(frmObject23.Value) Then
ssep2007 = frmObject23.Value
Else
ssep2007 = "000"
End If
For Each frmObject24 In mobjForm
If (InStr(1, frmObject24.ControlName, "txtoct2007" & sIndex) > 0) Then
If Not IsNull(frmObject24.Value) Then
soct2007 = frmObject24.Value
Else
soct2007 = "000"
End If
For Each frmObject25 In mobjForm
If (InStr(1, frmObject25.ControlName, "txtnov2007" & sIndex) > 0) Then
If Not IsNull(frmObject25.Value) Then
snov2007 = frmObject25.Value
Else
snov2007 = "000"
End If
For Each frmObject26 In mobjForm
If (InStr(1, frmObject26.ControlName, "txtdec2007" & sIndex) > 0) Then
If Not IsNull(frmObject26.Value) Then
sdec2007 = frmObject26.Value
Else
sdec2007 = "000"
End If
For Each frmObject27 In mobjForm
If (InStr(1, frmObject27.ControlName, "txtpast" & sIndex) > 0) Then
If Not IsNull(frmObject27.Value) Then
spast = frmObject27.Value
Else
spast = "000"
End If
For Each frmObject28 In mobjForm
If (InStr(1, frmObject28.ControlName, "txtfuture" & sIndex) > 0) Then
If Not IsNull(frmObject28.Value) Then
sfuture = frmObject28.Value
Else
sfuture = "000"
End If
If sFunctionCode <> "" Then
sQuery = "INSERT INTO ProjectFunction ( " & _
"internalProjectId, FunctionCode, jan2006, feb2006, mar2006, apr2006, may2006, jun2006, jul2006, aug2006, sep2006, oct2006, nov2006, dec2006, jan2007, feb2007, mar2007, apr2007, may2007, jun2007, jul2007, aug2007, sep2007, oct2007, nov2007, dec2007, past, future, " & _
"FunctionValue) " & _
"VALUES (" & pID & "," & _
"'" & sFunctionCode & "', '" & sjan2006 & "', '" & sfeb2006 & "', '" & smar2006 & "', '" & sapr2006 & "', '" & smay2006 & "', '" & sjun2006 & "', '" & sjul2006 & "', '" & saug2006 & "', '" & ssep2006 & "', '" & soct2006 & "', '" & snov2006 & "', '" & sdec2006 & "', '" & sjan2007 & "', '" & sfeb2007 & "', '" & smar2007 & "', '" & sapr2007 & "', '" & smay2007 & "', '" & sjun2007 & "', '" & sjul2007 & "', '" & saug2007 & "', '" & ssep2007 & "', '" & soct2007 & "', '" & snov2007 & "', '" & sdec2007 & "', '" & spast & "', '" & sfuture & "', " & _
"'" & sFunctionVal & "')"
CurrentDb.Execute (sQuery)
End If
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
Exit For
End If
Next
iRow = iRow + 1
Loop