problem in adding entries into the database

H

hima

ii have made comments in the code where i have problems..could anyone
help me on the same...

Private Sub CmdPerformAdd_Click()


Dim strSQL$, strValueList$, strTemp


strValueList = CStr(TxtDTPanelID) & "," & """" & cboDTPanel & """" & _
"," & """" & cboDTUpperMat & """" & "," & """" &
cboDTUpperFinish & """" & _
"," & """" & cboDTLowerMat & """" & "," & """" &
cboDTLowerFinish & """" & _
"," & """" & TxtTrimPlugs & """" & "," & """" &
CStr(txtNofTrimPlugs) & """" & _
"," & """" & txtTrimPlugLoc & """" & "," & """" &
txtSwitchLoc & """"


'after this i have 3 checkboxes belonging to switchtype...and i
have to include the checked options under column switch type in a
table)..........
'how do i do tat

'the following code which i have written is ok for 2 checkboxes i
suppose....and also if i have combo boxes again and then checkboxes
folowing them...then how should i proceed

'say after these checkboxes i have a combo box and then 8
checkboxes of switch material type

If SwitchTypeChk1 Then
strTemp = lblCol7Chk1.Caption & ","
End If
If SwitchTypeChk2 Then
strTemp = strTemp & lblCol7Chk2.Caption
End If
If Right(strTemp, 1) = "," Then
strTemp = Left(strTemp, Len(strTemp) - 1)

End If
If Len(strTemp) <> 0 Then
strValueList = strValueList & ",""" & strTemp & """"
Else
strValueList = strValueList & ","
End If



strSQL = "Insert into TestTable Values(" & strValueList & ")"

DoCmd.RunSQL strSQL
MsgBox strSQL


End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top