prinx
asked on
Create a TextArea control in MS Access form
hi guys,
i do not find any option to add a textarea control into my ms accessform, only textbox. Can someone teach me how to do it. thank you.
i do not find any option to add a textarea control into my ms accessform, only textbox. Can someone teach me how to do it. thank you.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
If you're adding this control as described above, and it is bound to a table source, make sure that table source is defined as a memo field. Text fields are limited to only 255 characters.
J
J
ASKER
Thanks guys...anyway, is there no other way to make it works more like a textarea in a webpage, without using ctrl-enter? thanks
This seems to work
Private Sub yourfield_KeyDown(KeyCode As Integer, Shift As Integer)
Dim myString As String
Dim strLen As Long
myString = Me.yourfield.Value
strLen = Len(myString)
Select Case KeyCode
Case vbKeyReturn
myString = myString & " " & Chr(10) & ""
Me.yourfield.Value = myString
Me.yourfield.SelStart = strLen + 2
KeyCode = 0
End Select
End Sub
Private Sub yourfield_KeyDown(KeyCode As Integer, Shift As Integer)
Dim myString As String
Dim strLen As Long
myString = Me.yourfield.Value
strLen = Len(myString)
Select Case KeyCode
Case vbKeyReturn
myString = myString & " " & Chr(10) & ""
Me.yourfield.Value = myString
Me.yourfield.SelStart = strLen + 2
KeyCode = 0
End Select
End Sub
revised after market...
Just to demonstrate...not recommended
just cause you can do a thing...doesn't mean you should
Option Compare Database
Dim FullString As String
Private Sub yourfield_GotFocus()
FullString = ""
End Sub
Private Sub yourfield_KeyDown(KeyCode As Integer, Shift As Integer)
StringCount = StringCount + 1
If KeyCode <> vbKeyReturn Then
FullString = FullString & Right(Me.yourfield.Text, 1)
Else
FullString = FullString & Right(Me.yourfield.Text, 1) & Chr(10) & " "
Me.yourfield.Value = FullString
Me.yourfield.SelStart = Len(FullString)
KeyCode = 0
End If
End Sub
Just to demonstrate...not recommended
just cause you can do a thing...doesn't mean you should
Option Compare Database
Dim FullString As String
Private Sub yourfield_GotFocus()
FullString = ""
End Sub
Private Sub yourfield_KeyDown(KeyCode As Integer, Shift As Integer)
StringCount = StringCount + 1
If KeyCode <> vbKeyReturn Then
FullString = FullString & Right(Me.yourfield.Text, 1)
Else
FullString = FullString & Right(Me.yourfield.Text, 1) & Chr(10) & " "
Me.yourfield.Value = FullString
Me.yourfield.SelStart = Len(FullString)
KeyCode = 0
End If
End Sub
There is a toolbar that is on by default that should give you access to this control when your form is in Design View. The Button looks like...
AB|
Click on that button and drop the text box anyplace on the form you'd like. You can even give it different dimentions by going into the properties menu (which you can get to by right clicking on the text box and slelcting properies), or by clicking on onne of it's 8 anchor points whereby you can resize by a click, drag and release wth the moust..
If you have the form opened in design veiw all the above should apply. Just remember to have the form in Design View as that is what allows you to build your form (and add text boxes for example).
Rick