(Solved) – how to increase indent in a list memo field of current line by using the tab key in MS Access?

  • by

I have a memo field in an MS Access database where I create notes. I often use bulleted lists in this note field that is displayed on a form with a large text box.

The MS Access default when tab key is pressed is to cycle to the next control, however when I’m editing a my “note” (memo field type) text box making a bulleted or numbered list I want it to indent that line.

After much tinkering I have been able to “catch” the tabkey and execute “IndentIncrease” from the commandbar object. (“Catching” the tab key required using the KeyPress event of the text box, and turning off tabstop on all objects in the form).

HOWEVER, this indents the bottom line of the field, even if the cursor is in the middle somewhere. Using the mouse to click the “increase indent” button in the text formatting section of the Ribbon works fine and indents the intended line of the ribbon.

Is there any way to get my code to catch the tab key and indent the correct line of my memo field?

Thanks in advance to anyone who wants to take a stab at assisting me.

Private Sub tbNoteEditor_KeyPress(KeyAscii As Integer)

If KeyAscii = 9 Then
   Application.CommandBars.ExecuteMso ("IndentIncrease")
End If

End Sub

Leave a Reply

Your email address will not be published. Required fields are marked *