Access 2007 Resize Checkbox

Stew
StarLounger
Posts: 76
Joined: 14 Jul 2010, 19:35

Access 2007 Resize Checkbox

Post by Stew »

I am attempting to resize a checkbox. I have found that it is unable to do. However what seems to be suggested is creating a checkbox using autoshapes and a "check" character to have a custom checkbox that is resizeable. I have been trying to find example code for this, however unable to find working code. Does anyone have an example that I can base my work off for this? Thank you.

User avatar
HansV
Administrator
Posts: 78527
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access 2007 Resize Checkbox

Post by HansV »

Welcome to Eileen's Lounge!

You could use a label; set its font to Wingdings in a large font size, for example 36, and set its caption to Alt+0168; this is a box in Wingdings. Let's say you name the label lblCheck.

Create the following On Click event procedure for the label:

Code: Select all

Private Sub lblCheck_Click()
  If Me.lblCheck.Caption = Chr(254) Then
    ' Action if check box cleared
    ...
    ' Change caption
    Me.lblCheck.Caption = Chr(168)
  Else
    ' Action if check box ticked
    ...
    ' Change caption
    Me.lblCheck.Caption = Chr(254)
  End If
End Sub
Character 254 is a box with a check mark.
Best wishes,
Hans

Stew
StarLounger
Posts: 76
Joined: 14 Jul 2010, 19:35

Re: Access 2007 Resize Checkbox

Post by Stew »

Thank you for the info. I think I understand but I am having trouble implementing this. Would if be possible to get an example where the click will actually change the boolen. The example seems like it just simulates the checkbox as a label and has now effect on the data. Thank you.

User avatar
HansV
Administrator
Posts: 78527
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access 2007 Resize Checkbox

Post by HansV »

I have attached a small demo database (Access 2000 format, zipped) with a form based on the Products table from the NorthWind sample database.
The code behind the form makes it appear that the "check box" label is bound to the ysnDiscontinued field in the table.
LabelCheckDemo.zip
You do not have the required permissions to view the files attached to this post.
Best wishes,
Hans

Stew
StarLounger
Posts: 76
Joined: 14 Jul 2010, 19:35

Re: Access 2007 Resize Checkbox

Post by Stew »

Thanks alot Hans, that example really helped me understand that macro.

User avatar
HansV
Administrator
Posts: 78527
Joined: 16 Jan 2010, 00:14
Status: Microsoft MVP
Location: Wageningen, The Netherlands

Re: Access 2007 Resize Checkbox

Post by HansV »

I'm glad it helped.

Just a general comment: it's fun coming up with workarounds such as the label-as-check-box in this thread, or the bound/unbound text box combo to display part of a SSN as asterisks in the other thread (Hiding part of a text fields input), and it's useful in the sense that it forces you to think about the way Access works. But as a rule, I like to stick as closely as possible to the built-in way of doing things in Access - for example, in a 'real' database I'd prefer to use the Access check box even though it can't be resized.

But please do not let that deter you from asking questions - they're very welcome!
Best wishes,
Hans