Archive for the ‘Microsoft Access Development’ Category

Adding Bullets in Microsoft Access

Monday, May 17th, 2010

Ever wanted to add bullets in Microsoft Access 2003?  I have usually inserted a dash, but playing around recently found I could create a button to insert a bullet.  Here is the solution.

Assume you have a textbox called txtInfo. You need to track where the cursor is in the textbox.  To do this create a place to record the position.

Dim intCursorPosition As Integer

In the On Click and On Keydown events for the textbox do the following.

Private Sub txtInfo_Click()
intCursorPosition = Me.txtInfo.SelStart
End Sub

Private Sub txtInfo_KeyDown(KeyCode As Integer, Shift As Integer)
intCursorPosition = Me.txtInfo.SelStart
End Sub

Put a button on the form beside the textbox.  Call it btnBullet  Post the following code into the On Click event

Private Sub btnBullet_Click()

Me.txtInfo.SetFocus
Me.txtInfo = Left(Me.txtInfo, intCursorPosition) & vbCrLf & Chr(149) & ”  ” & Mid(Me.txtInfo, intCursorPosition + 1, Me.txtInfo.SelLength – intCursorPosition)
Me.txtInfo.SetFocus
Me.txtInfo.SelStart = intCursorPosition + 5

End Sub

How it works

The On Click and Keydown events will have told you where the cursor was located prior to the button being selected.  That information is stored in intCursorPosition.  The first thing that needs to happen is to return the focus to the textbox.

You now construct the contents of the textbox by taking the text to the left of the cursor position, adding a return, adding Chr(149) which is a bullet, adding two spaces, and finally adding the text to the right of the cursor position.  The rest of the code is to put the cursor after the bullet and two blank spaces.

Gantt Chart Software – Beta Release

Tuesday, August 4th, 2009

Project Perfect are today making available a beta release of our new Gantt Chart tool. It runs on Microsoft Access and allows you to create your own Project Plans. If you would like to give it a try,  contact us at the following address.

gantt@projectperfect.com.au

It is a beta release, so there will probably be a few problems still to be ironed out.  Please let us know what the problems are by either posting to this blog item, or sending an email to gantt@projectperfect.com.au

The beta release has a 30 day life from when it is first installed.  As we pick up any issues, and create a new build, you will be prompted to download the new file.  This is also new functionality so be sure to let us know if there are any issues with the automatic update.

The download file is a zip file.  Within that zip is the install file and a quick start guide.  It is simple to load the file, but any issues should be covered in the quick start guide.  When you open it, you are prompted for a user name and password.  Both are “admin”.

Microsoft Access VBA If Statement

Tuesday, July 14th, 2009

One of the most valuable tips I was ever given related to the use of If statements in Access VBA.  A much more experienced Microsoft Access Developer told me when I was first starting out “As soon as you put an If statement in code, put an End If statement below.”  It is easy to have nested If statements and forget to put an End If somewhere in the code.  You can spend considerable time going through the code looking for the missing, or extra End If.  If you put the End If in immediatly, you can back up a line and put in all the code between If and End If.  Over the years it has saved me hours of bug tracking.

Stage 1

If me.txtBox = 0 then

End If

Stage 2

If me.txtBox = 0 then

now you can fill in the actions if the condition is true

End If

Microsoft Access General Functions

Tuesday, July 7th, 2009

As a Microsoft Access developer you tend to use the same functions over many applications.  Each time you reuse the code, there is the risk you miss a part, or make a mistake.  It is much easier to have your own library of functions.  Here are three I use –  Click Here to view –  They are simple – only  a few lines – but they have their own error handling built in, and I have proven over many applications that they work.

If you have any routine functions that you would like to share, please add them to this blog.

Best Book on Access Programming

Tuesday, June 23rd, 2009

I have been asked a number of times what is the best book to take an average Access User to the next level?  We assume a person is competant in using Access and has dabbled in VBA but wants to move up to the next level.

One book stands out for me and surprisingly it goes back to 2003.  The book is “Access 2003 VBA” by Paticia Gardoza, Teresa Henning, Graham Seach and Armen Stein.  The book runs over 950 pages hence the four authors.  It is well written without being too dry.  It is also organised into chapters that are self contained.  About 300 of the pages are appendicies covering all aspects of usage from object models to registry settings.  The only aspect that has changed significantly is the use of ADO which seems to be fading out.  If anyone is looking for a single reference book, I can fully recommend this one.  As a developer of Microsoft Access Solutions, we find it invaluable.

If you have any good books on Access you have used, please add your comments below.