Syntax for passing control value to SQL in Access VBA
Posted on 2008-10-14
I have an update query that runs an update via ADODB command, but I don't know how to pass the value of the form control to the SQL string. Here is what I have:
Private Sub Form_Close()
Dim myStr, strGroupSQL As String
Dim myRad24, myRad16, myRad4 As Boolean
Dim cmdCommand As ADODB.Command
Set cmdCommand = New ADODB.Command
Set cmdCommand.ActiveConnection = CurrentProject.Connection
myRad24 = Forms!frmLabels!radio24
myRad16 = Forms!frmLabels!radio16
myRad4 = Forms!frmLabels!radio4
strGroupSQL = "UPDATE Tbl_Persistent SET Radio24 = & myRad24 & "
cmdCommand.CommandText = strGroupSQL
I know the issue is with the syntax for the control, but I don't know where to find the "rules" for how to treat the control to pass it in.