Microsoft Access VBA: Convert Query or SQL to String

I wanted to take a query and format part of its output into English; a list of names separated by commas. The DAO Object Library includes a completely pointless Recordset.GetRows command which returns an unwieldy multi-dimensional array. How pointless and unwieldy? Well, the supplied example to Debug.Print FirstName, LastName and Title from Northwind.mdb’s Employees table [...]

Ordinal Suffixes for all dates and numbers; Show 3rd instead of 3

A surprising omission from the extensive number formatting goodies in Visual Basic (VB) is the ability to append the appropriate ordinal suffix to a number. This is most often used when writing dates in prose. For example, you would write 3rd February 2009, not 3 February 2009. This VB / VBA function returns your number [...]

Microsoft Access Visual Basic Form Helper: SetOpacity

This function allows you to set the opacity for a PopUp form. Normally, forms are fully opaque and you cannot see through the form. When it is partially opaque, you can partially see what is behind the form. I use it for smoothly fading in and out forms in my Microsoft Access application (specifically, a [...]

Microsoft Access Visual Basic Form Helper: Replacement for DoCmd.OpenForm for neater code

Frequently in Microsoft Access Visual Basic you will want to programmatically display a different record on a currently open form but this common requirement turns out to be a bit more fiddly than you might expect. Manually setting the Filter and FilterOn form properties or using RecordSetClone and FindFirst are all somewhat less than intuitive. [...]

Microsoft Access Visual Basic Form Helper: BringToTop function

This function allows you to bring a specific form to the top so that you can be certain that the user can see it.   To use: Save this code into a new module called FormHelper. Call FormHelper.BringToTop with the Form object you wish to bring to the top. The code is fully commented and [...]

Microsoft Access Visual Basic Form Helper: FormOpen function

Sometimes in Microsoft Access Visual Basic you will want to know whether a form is open or not. This common requirement turns out to be a bit more fiddly than you might expect. My original version of this function also returned True if the form was open but hidden or open in Design View. This [...]

Microsoft Word Paste Special As Unformatted Text Keyboard Shortcut

I have cause to repeatedly use the Paste Special -> As Unformatted Text function in Microsoft Word. However, it is not terribly convenient to paste then adjust using the Smart Tag or paste using the Edit -> Paste Special dialog box. So, add I have added a macro called PasteSpecial and assigned it to a [...]

Microsoft Access 2002 – Emulate Vista Dimming / Attention Focus

UPDATE 29 June 2007: You must extract the MDB from the zip for it to work (!). It will not work on a read-only database. Download ApplicationDimmer.zip While I have no intention of upgrading to Vista at this time I did note an interesting user interface paradigm that helps call undivided attention to a message [...]

Microsoft Access 2002 – Emulate hyperlink cursor change

I’m still using Microsoft Access 2002 and thought I’d share this little tip. You know how in web browsers hyperlinks are underlined in blue and your cursor changes to a little hand when you move over them? Using a slightly bizarre but agreeable undocumented feature you can emulate the cursor change in Microsoft Access 2002. [...]

Follow

Get every new post delivered to your Inbox.