PC Review


Reply
Thread Tools Rate Thread

Command Button to Check Checkbox

 
 
yons
Guest
Posts: n/a
 
      14th Jan 2008
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.
--
Kate
Just learning to use access

 
Reply With Quote
 
 
 
 
fredg
Guest
Posts: n/a
 
      14th Jan 2008
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
 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Button to Check Checkbox Kate Microsoft Access 5 14th Jan 2008 07:19 AM
Click checkbox with command button =?Utf-8?B?Unlhbg==?= Microsoft Access Form Coding 1 6th Jun 2007 08:05 PM
Set checkbox to true on command button click =?Utf-8?B?Unlhbg==?= Microsoft Access Form Coding 1 6th Jun 2007 03:22 PM
Auto checkbox check on button event Ladybird Microsoft Access Form Coding 2 31st May 2005 09:21 AM
Button Enabling based on check in checkbox Todd Huttenstine Microsoft Excel Programming 2 25th Nov 2003 04:56 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:45 PM.