Select All on Filtered Record Set

  • Thread starter Thread starter Minikoop
  • Start date Start date
M

Minikoop

I have the following code....it is for a select all botton on a
filtered record set on a subform.....but it's not working. I get the
following error, "too few parameters. Expected 1"

Private Sub Command34_Click()
Me.Refresh
Dim strFormvalue
Dim strSQL As String
strFormvalue = Forms!ActivityMaster!Combo11
strSQL = "UPDATE [tbl_YesNo] SET [tbl_YesNo].[Yes_No] = True WHERE
[tbl_YesNo].[AC] = [Forms]![ActivityMaster]![Combo11];"
CurrentDb().Execute strSQL, dbFailOnError
Me.Recalc
MsgBox "Reset Complete"
End Sub
 
Put the reference to the form outside of the quotes:

strSQL = "UPDATE [tbl_YesNo] SET [tbl_YesNo].[Yes_No] = True WHERE
[tbl_YesNo].[AC] = " & [Forms]![ActivityMaster]![Combo11]

if AC is a numeric field, or

strSQL = "UPDATE [tbl_YesNo] SET [tbl_YesNo].[Yes_No] = True WHERE
[tbl_YesNo].[AC] = " & Chr$(34) & [Forms]![ActivityMaster]![Combo11] &
Chr$(34)

if it's a text field.
 
The value you want to pass needs to be outside the quotes:
strSQL = "UPDATE [tbl_YesNo] SET [tbl_YesNo].[Yes_No] = True WHERE
[tbl_YesNo].[AC] = " * [Forms]![ActivityMaster]![Combo11] & ";"
 

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

Back
Top