On Mon, 14 Jan 2008 05:46:05 +0200, yons wrote:
> Trying to create a command button to check certain boxes.
> Table is Addresses
> Married is checkbox
> PrintLabel is checkbox
>
> Want to check printlabel on all forms that married is not checked.
> The If statement works on the form I am on only,
> so I tried an SQL but says syntax error.
>
> Private Sub cmdCheckAllPrintLabel_Click()
> On Error GoTo Err_cmdCheckAllPrintLabel_Click
> 'If Me.Married = False Then
> 'Me.[Print Label] = True
> 'End If
> CurrentDb.Execute "UPDATE Addresses Where [Married] = 0 Set [Print Label] =
> -1", dbFailOnError
> Me.Requery
>
> Exit_cmdCheckAllPrintLabel_Click:
> Exit Sub
>
> Err_cmdCheckAllPrintLabel_Click:
> MsgBox Err.Description
> Resume Exit_cmdCheckAllPrintLabel_Click
>
> End Sub
>
> Thanks in advance.
regarding: >Want to check printlabel on all forms that married is not
checked.<
It seems you are mixing up the word 'forms' for the word 'records'.
A table contains records (which in turn contains fields) which stores
the data.
A form displays the record's data and allows data entry and
manipulation.
Try it this way:
CurrentDb.Execute "UPDATE Addresses Set Addresses.[Print Label] =
-1 Where [Married] = 0;", dbFailOnError
--
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
|