Share via

Enter Bullet in Text Box

Anonymous
2021-03-11T16:34:25+00:00

Good day.

  • Trying to insert a bullet in a text box to make point form notes. I can use either a button or when pressing enter (preferred)
  • Using enter seems to work but it seems like it retains memory of other bullets I've entered and deleted. PLUS it seems to select all text on it's own and when you press the right arrow to start typing it leaves the text box record. Very frustrating.
  • So all in all I found one that works but seems to encompass some weird behavior. I don't want or need all the hoopla, just enter a bullet on button down and leave it at that, no special activities, no special selection behaviors, just put a place a bullet the LEAVE!!! No more stupid code.

This doesn't work properly. After trying several times then deleting the bullets, another enter gives: "Some text for the technique••••• "

Private Sub Notes_KeyDown(KeyCode As Integer, Shift As Integer)

    If KeyCode = vbKeyReturn Then

        If Notes.Value = "" Then

            'Notes.Value = "• "

        Else

            Notes.Value = Notes.Value & Chr(10) & "• " '[COLOR=#ff0000]KeyCode = 0[/COLOR]

        End If

    End If

End Sub

This doesn't work

Option Explicit

Dim oTextbox As MSForms.TextBox

Private Sub CommandButton1_Click()
Dim doClip As DataObject
Dim bulletStr As String
Set doClip = New DataObject
bulletStr = "? "
doClip.SetText bulletStr
doClip.PutInClipboard

' With Me.TextBox1 ' <<<<<<<<<<<<<<<<<<<<<< what did you expect
With oTextbox
.Paste
.SetFocus
End With

End Sub

This gives "User-defined type not defined" errors

Ok...you need something different.
For each textbox you want to have this functionality, go in properties > Other Tab > Tag property and write: Bullet
Replace the Button with a Label. (label doens't get focus)
Go in properties and in Hyperlink type a space -
Than in OnClick event type:
If me.ActiveControl.Tag = "Bullet" Then
Me.ActiveControl = Me.ActiveControl & VbCrLf & Chr(149)
Endif
If you have the focus in one of those textbox fileds and than click on that Label, a bullet will be added at the end on a new line.

How can it be so difficult?? Some of this code is from 2005, 2018 etc. Everything seems to have changed. 

CW

Microsoft 365 and Office | Access | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

2 answers

Sort by: Most helpful
  1. Anonymous
    2021-03-11T19:42:43+00:00

    Thanks Duane. I'm confused, I don't have any "" in the text of my textbox. Just want to put a simple bullet on enter.

    What I ended up doing was have a locked textbox on the form with the default set to "• ".

    Then added a button with the on click event:

    Me.Bullet.Locked = False

    Me.Bullet.SetFocus

    DoCmd.RunCommand acCmdCopy

    Me.Bullet.Locked = True

    So, to copy a bullet only took me 4 hours. Excellent. Gotta love this msft stuff.

    Was this answer helpful?

    0 comments No comments
  2. Duane Hookom 26,820 Reputation points Volunteer Moderator
    2021-03-11T17:46:14+00:00

    You could try a little code like this which replaces a \ with a bullet. The code can be modified to accommodate your requirements.

    Private Sub notes_KeyPress(KeyAscii As Integer)

    'replace a backslash "\" with a bullet
    
    If KeyAscii = 92 Then
    
        KeyAscii = 8226
    
    End If
    

    End Sub

    Was this answer helpful?

    0 comments No comments