473,320 Members | 2,145 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Help: how retrieve first line from memofield?

2 1411
This should work (but is not tested):

Public Function FirstLineOfText(strFromText As String) As String
Dim strResult As String
Dim lngLineBreakPos As Long
lngLineBreakPos = InStr(strFromText,vbCrLf)
If lngLineBreakPos > 0 Then
strResult = Left$(strFromText, lngLineBreakPos - 1)
Else
strResult = strFromText
End If
FirstLineOfText = strResult
End Function

If this is to be used when Nulls are possible, then perhaps, this...

Public Function FirstLineOfText(varFromText As Variant) As Variant
Dim varResult As Variant
Dim lngLineBreakPos As Long
varResult= Null
If IsNull(varFromText) Then Goto Fn_Return
lngLineBreakPos = InStr(varFromText,vbCrLf)
If lngLineBreakPos > 0 Then
varResult = Left$(varFromText, lngLineBreakPos - 1)
Else
varResult = varFromText
End If
Fn_Return:
FirstLineOfText = varFromText
End Function
On Mon, 3 Nov 2003 17:43:06 +1100, "Norman Fritag" <mt*****@ozemail.com.au>
wrote:


Nov 12 '05 #2
thanks Steve
your input was very much appreciated.
Regards
Norman
"Steve Jorgensen" <no****@nospam.nospam> wrote in message
news:dp********************************@4ax.com...
This should work (but is not tested):

Public Function FirstLineOfText(strFromText As String) As String
Dim strResult As String
Dim lngLineBreakPos As Long
lngLineBreakPos = InStr(strFromText,vbCrLf)
If lngLineBreakPos > 0 Then
strResult = Left$(strFromText, lngLineBreakPos - 1)
Else
strResult = strFromText
End If
FirstLineOfText = strResult
End Function

If this is to be used when Nulls are possible, then perhaps, this...

Public Function FirstLineOfText(varFromText As Variant) As Variant
Dim varResult As Variant
Dim lngLineBreakPos As Long
varResult= Null
If IsNull(varFromText) Then Goto Fn_Return
lngLineBreakPos = InStr(varFromText,vbCrLf)
If lngLineBreakPos > 0 Then
varResult = Left$(varFromText, lngLineBreakPos - 1)
Else
varResult = varFromText
End If
Fn_Return:
FirstLineOfText = varFromText
End Function
On Mon, 3 Nov 2003 17:43:06 +1100, "Norman Fritag" <mt*****@ozemail.com.au> wrote:

Nov 12 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: eboogyman | last post by:
I have an HTML form with Firstname, lastname, address I want to save the firstname, lastname and address appended to a file in say results.txt, in the below format 1 entry per line... ...
3
by: Alex Shi | last post by:
Hi, I need a regex (may be together with a php function) to retrieve information within '' in a line of text. Here is an example: hello world, example line with some yesys . I need to...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
9
by: hope | last post by:
Hi Access 97 I'm lost on this code please can you help ================================= Below is some simple code that will concatenate a single field's value from multiple records into a...
2
by: John Regan | last post by:
Hello All I am trying to find the owner of a file or folder on our network (Windows 2000 Server) using VB.Net and/or API. so I can search for Folders that don't follow our company's specified...
0
by: yeltsin27 | last post by:
I need some advice on handling dynamically added controls in a GridView. My app takes an uploaded CSV file containing addresses, converts it to a DataTable, databinds the DataTable to a...
2
by: alexsg | last post by:
I'm setting up a resolutions database where each resolution will be copied from Word documents and pasted into a memo field. The resolution will be in the form: Resolution title <cr> Project no...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
5
by: huiling25 | last post by:
I have a sdf file, i wan to retrieve product numbers from the file. However, when i print out, it only printed out the first product number(02230416222D). There are supposed to be 2 products numbers,...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.