Showing posts with label controls. Show all posts
Showing posts with label controls. Show all posts

Friday, February 22, 2008

Microsoft Controls Reference

Here's a link to keep handy: ActiveX Controls Reference on MSDN. It's written for VB and Visual Studio, rather than for VBA and Access, but the differences between the two are not important for this purpose. At least in my environment there's no help loaded for ActiveX controls such as Treeview, Listview, and DateTimePicker, so I use this reference to the properties, methods and events of these controls.

How do I resize my text box to fit my text?

You can set the Can Grow property of your text box to Yes all you like, it won't grow on your form when it's displayed. Can Grow only applies when a form or report is printed. So how do you make your text box adjust its size to exactly match the amount of text you're displaying?

Take a look at TextHeightWidth.zip on Stephen Lebans' site. It's actually pretty easy to implement and allows you to find out how big your text really is and to adjust the text box (or combo box or list box) accordingly.

Friday, October 19, 2007

Adding an Option for (All) to Combo Boxes or List Boxes

How do I get my combo box to show an option for "All"?

This is a pretty common question on the discussion boards.

Look around the net and you'll see one common technique for "adding to your combo box". this post at the Access Web shows you how to do it using a union query, which is the solution I've used pretty reliably.

But here's another way. This "visual how-to" on MSDN shows you how to exploit a (AFAIK) rarely discussed approach to combo boxes where a callback function provides the rows. (This "function as a row source" thing is really neat and I hope to do another post on it soon!) This approach may be overkill for most combo box scenarios. It is, IMHO, pretty elegant though. And I'm pretty sure it's more flexible too. And I think it's worth a read just to get a look at the combo box rowsource callback function.

The article discusses Access 2007, but I did the same thing in 2003 and it works just the same.

Saturday, September 22, 2007

Forms: Refer to Form and Subform properties and controls

Here's a useful reference to the right way to refer to a control on a form, or a control on a subform on a form, etc. Getting the syntax just right can be tricky.