Find Last instance of carriage return In a Memo Field

Hi,

I have a form where the user usually pastes a glob of text into it a memo 
field called "Comment".  After he pastes the text, the cursor is obviously at 
the end of the text.  I would like the user to be able to click a button and 
for the comment to be highlighted from the very end of the text to the first 
instance of a carriage return going backwards.  In other words, I want to 
automatically select the very last line of the comment.



I was thinking that I could use seldown, but I would need to first find the 
Last instance of  Chr$(13).  Or, can  the instr function can be used in 
reverse, meaning to search the string  starting from the end of the line?  

Thanks, in advance.

0
Utf
6/20/2007 1:11:16 AM
access.queries 6343 articles. 1 followers. Follow

2 Replies
1361 Views

Similar Articles

[PageSpeed] 12

On Tue, 19 Jun 2007 18:11:16 -0700, justme <justme@discussions.microsoft.com>
wrote:

>I was thinking that I could use seldown, but I would need to first find the 
>Last instance of  Chr$(13).  Or, can  the instr function can be used in 
>reverse, meaning to search the string  starting from the end of the line?  

In A2002 and later, there is an InStrRev() function which does just this:

Me!txtboxname.SelStart = InStrRev(Me!txtboxname, vbCrLf)

             John W. Vinson [MVP]
0
John
6/20/2007 1:29:10 AM
Okay, that is the coolest!

Thank you John!!!
0
Utf
7/4/2007 1:46:00 AM
Reply:

Similar Artilces:

Passing Field Values
Hi I have added a new button on to "Sales transaction Entry" screen. How to pass the screen control values to the corresponding button's function (in VBA) Regards Guru You will need to bring up the window and add the "control fields" to VBA. Then you can reference them in your VBA script and pass them to whatever other code you have written. David Musgrave Senior Development Consultant MBS Services - Asia Pacific Microsoft Business Solutions http://www.microsoft.com/BusinessSolutions mailto:dmusgrav@nospam-microsoft.com Any views contained within are my p...

Auto Filter returns no results
I have a spreadsheet with about 11 columns and 800 rows. I have all columns ready for auto filter. The last column (K) has numerical values in it, and I would like to search for all rows that contain a certain number. When I do this, it returns no results - even when I know that a number is listed. If I select to show all that 'equal' the number, it will return the result, but not when filtering for 'contains'. [I need to use 'contains' because some cells have more than one number in them (separated by commas).] I have Office Professional 2003 - Excel 2003 - SP2. ...

Why does CSplitterWnd::GetRowInfo() return -1 for a window size?
Greetings! I am trying to create a derivative of CSplitterWnd that will keep the ratio of its two panes constant when the window size changes. I create my splitter window with its two panes, one on top of the other, and then I call my derived class's RememberRatio() method, which is: void CHTSplitter::RememberRatio() { int current0, current1, min0, min1; int rowCount, columnCount; this->GetRowInfo(0, current0, min0); this->GetRowInfo(1, current1, min1); m_ratio = (double)current0 / (double)(current0 + current1); } I was surprised that the ratio was 0.5 when it should have be...

Append Query
I have a table "Rates" with the following data: StartDate: 5/15/08 End Date: 6/23/08 Rate: $53 StartDate: 6/24/08 End Date: 7/15/08 Rate: $86 StartDate: 7/16/08 EndDate: 9/19/08 Rate: $99 I have another table "Transactions". I want to create an append query such that if I supply the StartDate and EndDate, the query will populate the "Transactons" table with date and rate data from the "Rates" table for each and every day within the date range. Example: If I supply the StartDate of 6/23/08 and the EndDate of 6/25/08, the query would pop...

Can't find CD/DVDdrive
My DVD drives have disappeared. they don't show as hardware in control panel. Working fine yesterday - no software changes made. Both have power to them. I've unplugged everything and put a new lead from them to the motherboard. Doesn't appear to be anything physical. Followed various posts on this site. Mr Fixit recognises the problem but can't fix it. Went into registry. Higher filters there but no lower filters. Any suggestions? On 06/20/2010 05:13 AM, Philx5 wrote: > My DVD drives have disappeared. they don't show as hardware in control panel. ...

Running Access Query Returns Incorrect Number of Records
I am running some code which loops through and runs the queries in an Access Database. The count of the records is then stored in a Worksheet. For most of the queries, the figure stored in the Worksheet matches the number of records if you run the query in Access. But for certain queries, the count of the records does not match the number of records when the query is run in Access. If I change the query to a make table query and then base another query on that table, the results are correct. Can anybody suggest running the query from Excel would results in a different number of records bein...

"Find an event" feature in the Windows Live Mail/Calendar
In the Windows Live mail it is quite simple to "Find a message" as we type something in the search box and enter. But, I do not see any search box with the Calendar. Are there any ways to "Find" something in the Windows Live Calendar? Looking forward to hear from someone. Thank you. ...

Like numbers in a field
I am working with a 25,000 row parts issue listing that was created by parts issue date. There are many repeat numbers in the part number column as the same part would have been issued on several different dates. I would like to be able to combine the like part numbers to know how many parts were issued over the course of all of the dates. Any ideas??? The Column headers are Part Number, Quantity, Unit Price, Total Price and Transaction Date. Create a new query based on your parts issue listiong table. Drag the Part number field into the query grid twice. Click on the Total...

CFtpFileFind return null creation date
Hi All I am trying to list the URL and timestamp of some files on a server in a list box in a simple dialog using FTP. The code is as follows: void CFTPTestDlg::OnTest() { CListBox* pbox = (CListBox*)GetDlgItem(IDC_LB_FILES); pbox->ResetContent(); // Create session object to initialise libs CInternetSession sess(_T("My Test")); // Declare a FTPConnection CFtpConnection* pftpConn = NULL; try{ pftpConn = sess.GetFtpConnection("ftp.,mytestsite.co.uk", "mylogon","mypassword"); if (!pftpConn->SetCurrentDirectory("/Testdir/T...

Where can I find the newsgroups that have disappeared from the MS news server?
I've been an enthusiastic user of these wonderful MS newsgroups for years (mostly the Access groups), but I've noticed that Microsoft has been removing them from their news server. Are the discussions continuing on a Web-based forum somewhere? If so, I'm disappointed because I've found reading the message threads with a newsreader like Outlook Express is much more convenient than trying to manage the browser-based forums. But if that's the only thing available, I'd gladly use them. Can anyone tell me where I can go to find the question and answer gro...

Does anyone use "location" field in Outlook?
After all these years, I just noticed when I go to make an appointment in Outlook (2003version, with BCM), that there's a second field after "subject" which would seem to be the one everbody mostly uses. The appointment fields are: 1. SUBJECT: (example: "Conference call with Joe and Mary) 2. LOCATION: (does anyone use this?) Is the idea to put something like "Annapolis, MD" meaning maybe a meeting there or something? I know it's a hokey question, but wondered about some examples of how other people are using it. Thanks, G Standard following us...

Empty From: field
Hi. We use a exchange 2003 server and I have notice that my outlook 2003 client behaves strange if the From tag in the header looks like this; From: �� <sender@domain.com> I�ve hooked up Thunderbird and it shows the From field as I think it should, instead of a blank from field it shows sender@domain.com If the header looks like this; From: sender@domain.com or like this; From: �name� <sender@domain.com> it works just fine. The problem is the first example� Any ideas? Cheers Jonas Jonas <barre@gargamel.nu> wrote: > We use a exchange 2003 server and I have notice th...

Finding sheets
I'm just an inquisitive person, I guess ;-) I would like to create the name of a particular sheet dynamically, then read data from it. For example, ="'"&MONTH(A1)&"."&DAY(A1)&"."&TEXT(MOD(YEAR(A1),100),"00")&"-"&MONTH(B1) &"."&DAY(B1)&"."&TEXT(MOD(YEAR(B1),100),"00")&"'!"&"A3:A50" That will give me the name of a particular sheet. A start date and end date are in A36 and B36, respectively. I would like to take the name of the s...

how to create a field based on many different conditions
Hi, I'm trying to create a field based on many different conditions in Make Table Query in Access 2003, e.g., if VAR1 and VAR2 meet certain condition, assign a value "A" to the new field "Category"; if VAR1 and VAR2 meet other condition, assign a value "B" to "Category" so on and so forth. I keep getting separate field for each condition, something like "Expr1023". Please help! Thank you! Since you haven't provided the expression or SQL statement, I will assume it is quite complex. I would remove the complexity from the query ...

Sorting Spreadsheet with Merged Fields
I have a huge spreadsheet that currently fits comfortably on an 11 x 17" page making it difficult to work with and understand....just too big. I'd like to make the spreadsheet fit on an 8.5 x 11" (landscape) page by stacking fields. This is marketing pursuit data so most fields hold text. When I stack the fields some fields must be merged. So far...not tough....I have a beautiful spreadsheet with all the data in a convenient format, easy to understand. The problem is sorting the first field (priority) per field grouping....can't sort because of merged fields. I t...

Search a field
Hi, I'd like to have a small button next to specific fields in my form, which when clicked, will allow the user to search all records relating to that field. In my case my serached vehicle will be Vehicle Regstration, Surname, Reference and Accident Date. Is there an easy way to do this? Regards, Ritchie. Put a command button on the form. When you start command button it will run a wizard for the setup. Tell it you want a search function. After the search button is ready, run it and set up the search procedure you want. "RitchieJHicks" wrote: > > Hi, > >...

Reference last entry in column
In Excel 2002, I need a way to reference the last entry in a column of data that has data added to it on a regular basis. Is there a way to do this that is fairly simple? I am trying to make a checkbook register in excel and I want to have the current balance shown in one place at the top so that when the list of entries gets long the user doesn't have to scroll to the bottom to see the current balance. I also want to have it show on a different sheet where the current balances for different accounts can all be seen one one page. Any help would be appreciated. Hi see: http://www.xl...

Hard return in wraptext cell?
Is there a way to place a hard return(carriage return) in a cell with wrap text format so as to align text in the way user wants rather than what excel places? Thanks Mark Sure. Where you want a new line just press Alt+Enter. To remove that just place the cursor at the end of the line before the new line and press Delete Tyro "MP" <NoSpam@Thanks.com> wrote in message news:OAFfO3vVIHA.4880@TK2MSFTNGP03.phx.gbl... > Is there a way to place a hard return(carriage return) in a cell with wrap > text format > so as to align text in the way user wants rather than wh...

outline won't number after hitting return
I've set up the document per Shauna Kelly's instructions, but can't figure out why it won't continue to number the outline. It'll give me Heading 1, but when I hit return it goes back to "normal". What in the world am I doing wrong? You would need to modify the Heading 1 style so that it is followed by Heading 1 style (though that is not what would normally be wanted as a heading is normally followed by some text. -- Hope this helps, Doug Robbins - Word MVP Please reply only to the newsgroups unless you wish to obtain my services on a pai...

Control+Z was Undo, now Shrink. How to return to enlarged view?
"Control+Z" used to be Undo, now became shortcut for Shrink. How to return to enlarged view of my email text body, pls? Thank you. Gary garyfan@hughes.net This doesn't sound like an Outlook issue...sounds like another program is hijacking the traditional Windows shortcut keys. See if you can figure out which one...likely one you installed around the time this started happening. -- Jocelyn Fiorello MVP - Outlook *** Messages sent to my e-mail address will NOT be answered -- please reply only to the newsgroup to preserve the message thread. *** "Gary Fan&qu...

Getting the "name=" (bit, picklist) value that is returned from SOAP
Hi all, I am getting several fields via a Web service request in javascript in an OnChange event to poulate other field on a case. One of those fields is a bit, and one is a picklist. Those nodes in the response come back with <attribute="new_active" name="true">1</attribute> for the bit field and <attribute="status" name="On Hold">3</attribute> How can I read the name value? I've tried selectSingleNode("//status").name with no luck. Thanks! I am doing a similar process, using a SOAP response message. I ge...

Find Where Specific Fonts Have Been Used in a PowerPoint Presentat
Is there a way to find where specific fonts have been used in a PowerPoint presentation. The Contents tab of the Advanced Properties pane list the fonts that are used in a presentation but not where. MS Word will search for fonts with the find dialogue. I am looking for similar functionality with PowerPoint. In article <6CDAC5DB-AFCF-4485-9EAB-5146B5B5411C@microsoft.com>, John B wrote: > Is there a way to find where specific fonts have been used in a PowerPoint > presentation. The Contents tab of the Advanced Properties pane list the > fonts that are used in a...

Linking Outlook fields from the "Contact Folder" to a custom form in Outlook...
Using Exchange Server 2003/Outlook 2003, we have created a custom Help Desk form in Outlook. We would like the ability to link specific fields from the Contacts Folder (Example B), in a drop-down list box if possible. We are far from knowing that something like this is even possible. Would appreciate *any* suggestions. Thank you. ...

Any reason CurrentDb.TableDefs(0).Connect returns empty sting in Access 2007?
I use the function below to return the server or database name for various uses. However, now that we've switched to 2007 the line CurrentDb.TableDefs(0).Connect which used to return the connection string is returning an empty string. Any ideas? Thanks, Jeremy Function GetConnectionProperty(ServerOrDatabase As String) As String ' Returns name of connected server if "Server" passed in. ' Retuns name of connected Database if "Database" passed in. Dim sConnectionString As String Dim aConnectionPieces() As String Dim sConnectionPiece As String Dim i As ...

Can my form fill in a field, yet allow me to override?
Each customers is sent to us from a salesman, and we provide service for 1-7 days before the activity ends. A new charge is generated for each day of service. Employee #1 uses the customer service form to generate a bill, and includes the name of the salesman. Employee #2 uses the form to generate a bill on the next day, and has to look up the first bill, in order to know which salesman to record. The same thing happens every day until the activity ends. With each new referral for service, there's a strong chance it will be due to a different salesman, so the customer number an...