Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsFormsForms ProgrammingQueriesModules / DAO / VBAReports / PrintingMacrosDatabase DesignSecurityConversionImporting / LinkingSQL Server / ADPMultiuser / NetworkingReplicationSetup / ConfigurationDeveloper ToolkitsActiveX ControlsNew UsersGeneral 1General 2
Access DirectoryToolsTutorialsUser Groups
Related Topics
SQL ServerOther DB ProductsMS OfficeMore Topics ...

MS Access Forum / Forms Programming / March 2007

Tip: Looking for answers? Try searching our database.

Add text to Memo field

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
mattc66 - 13 Mar 2007 22:16 GMT
Hi All,

I have 2 check boxes. If you check the box the on lick event adds text to a
memo field.

This issue is the last box checked text overrights the first. How would I add
the additional text without removing the first?

If me.ckbox1 = -1 then
me.memo1 = "TEXT 1"
end if

If me.ckbox2 = -1 then
me.memo1 = "TEXT 2"
end if

Signature

Matt Campbell
mattc (at) saunatec [dot] com

fredg - 13 Mar 2007 22:45 GMT
> Hi All,
>
[quoted text clipped - 11 lines]
>  me.memo1 = "TEXT 2"
> end if

I'll assume you would like at least one space between the old and the
new data.

If me.ckbox1 = -1 then
me.memo1 = Me.memo & " " &  "TEXT 1"
end if

Here I'll assme a new line between the old and new data.

If me.ckbox2 = -1 then
me.memo1 = Me.memo & vbNewLine & "TEXT 2"
end if

Take your pick.

Signature

Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail

mattc66 - 13 Mar 2007 22:57 GMT
That worked great. One more question if the user unchecks the box is there a
way to find and remove the text from the memo box?

>> Hi All,
>>
[quoted text clipped - 16 lines]
>
>Take your pick.

Signature

Matt Campbell
mattc (at) saunatec [dot] com

Anthos - 15 Mar 2007 00:48 GMT
I would do it like this.

Add this to each of the check box's on change event's.

Private Sub ckbox1_Click()
If Me.ckbox1 = -1 Then
   Me.memo1 = Me.memo1 & " " & "TEXT 1"
Else
  Me.memo1 = Left(Me.memo1.Value, (Len(Me.memo1.Value) - Len("TEXT
1")))
End If
End Sub

this would work if the "TEXT 1" was at the end of the memo field.
If the "TEXT 1" was at the begining, you would use the RIGHT function
isntead of the left.

Private Sub ckbox1_Click()
If Me.ckbox1 = -1 Then
   Me.memo1 = "TEXT 1" & " " & Me.memo1
Else
   Me.memo1 = Right(Me.memo1.Value, (Len(Me.memo1.Value) - Len("TEXT
1")))
End If
End Sub

Hope that helps.

Regards
Anthony
missinglinq - 15 Mar 2007 15:58 GMT
And if TEXT1 is in the middle of the field?

Me.Memo1 = Replace(Me.Memo1, Me.TEXT1, "")

Actually, I think that would work regardless of where it is in the string.

Signature

There's ALWAYS more than one way to skin a cat!

Answers/posts based on Access 2000

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.