473,809 Members | 2,805 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Memo field contents to String Variable

I am having problems trying to assign the contents of a Memo table
field to a String variable in VB using the following code:

Private Function udfBuildSQL(SQL ID As Integer) As Variant

Dim rs As Recordset
Dim db As Database
Dim rSQL As String
Dim strSQL As String
Dim fld As Field
Dim fldLen As Long
Dim fldOffset As Long
Dim varChunk As Variant

Const cFldLen = 100
Set db = CurrentDb
rSQL = "SELECT * FROM tblSQL WHERE SQLID = " & SQLID

Set rs = db.OpenRecordse t(rSQL)

Set fld = rs.Fields("SQLS tring")

fldLen = fld.FieldSize
fldOffset = 0

Do While fldOffset <= fldLen

varChunk = fld.GetChunk(fl dOffset, cFldLen)
strSQL = strSQL & varChunk
fldOffset = fldOffset + Len(varChunk)
fldLen = fldLen - Len(varChunk)
If Len(varChunk) = 0 Then
Exit Do
Else: End If

Loop

udfBuildSQL = strSQL
End Function

Although the GetChunk retrieves the data correctly, the strSQL
variable doesn't take more than the first 250 or so characters. At
first I thought I might be hitting a similar limit to the 255
character maximum for a text table field, but have since confirmed
that this limit does not apply to string variables.

I have tried other methods to populate the strSQL variable, but it
still is limited to the first 250 or so characters.

Any suggestions or solutions would be greatly appreciated.

Thanks

Martin Heal
Nov 13 '05 #1
1 6111
I find
DLookup("SQLStr ing","tblSQL ","SQLID=" & SQLID)
will return the full string, even for a memo field longer than 250
characters.

I'm using Access 2000 - what about you?
"Martin Heal" <mh***@bigfoot. com> wrote in message
news:80******** *************** ***@posting.goo gle.com...
I am having problems trying to assign the contents of a Memo table
field to a String variable in VB using the following code:

Private Function udfBuildSQL(SQL ID As Integer) As Variant

Dim rs As Recordset
Dim db As Database
Dim rSQL As String
Dim strSQL As String
Dim fld As Field
Dim fldLen As Long
Dim fldOffset As Long
Dim varChunk As Variant

Const cFldLen = 100
Set db = CurrentDb
rSQL = "SELECT * FROM tblSQL WHERE SQLID = " & SQLID

Set rs = db.OpenRecordse t(rSQL)

Set fld = rs.Fields("SQLS tring")

fldLen = fld.FieldSize
fldOffset = 0

Do While fldOffset <= fldLen

varChunk = fld.GetChunk(fl dOffset, cFldLen)
strSQL = strSQL & varChunk
fldOffset = fldOffset + Len(varChunk)
fldLen = fldLen - Len(varChunk)
If Len(varChunk) = 0 Then
Exit Do
Else: End If

Loop

udfBuildSQL = strSQL
End Function

Although the GetChunk retrieves the data correctly, the strSQL
variable doesn't take more than the first 250 or so characters. At
first I thought I might be hitting a similar limit to the 255
character maximum for a text table field, but have since confirmed
that this limit does not apply to string variables.

I have tried other methods to populate the strSQL variable, but it
still is limited to the first 250 or so characters.

Any suggestions or solutions would be greatly appreciated.

Thanks

Martin Heal

Nov 13 '05 #2

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

Similar topics

8
2107
by: Tim Pollard | last post by:
Hi I am trying to filter a table of users to select only those records whose roleID matches a value in an array. There could be any number of IDs held in the array from one to a few hundred. The array is generated by splitting a comma delimited memo field from a second table in an Access DB. I can split the memo field OK, I can response.write its values, but what I now want to do is add a value from another table to my reponse write...
6
10481
by: Shyguy | last post by:
I want to create two buttons on a form. One would allow the user to Copy the contents of the current records memo field, the other would allow them to print. I set up a report based on the memo field, and it works. But, it seems wrong since I had to create a huge text box to accommodate memo fields with a lot of text. Thanks for any help, ShyGuy
1
2413
by: Steemer | last post by:
Okay, I checked with usual suspects and I'm still frustrated. ..txt file, fixed width. About 88 fields of varying length. All text fields. It will only let me add seperators to about the 410th position but there are 420 positions. What's going on?
2
5240
by: Bob Dydd | last post by:
Hi Everybody I have a Listbox that has a Memo field attached to it's 2nd column which on double click copies the memo field to another Memo Field. Forms!! = ListClassification.Column(1) My problem is that the receiving Memo Field Truncates at 255 characters
3
3039
by: John | last post by:
I have a field, data type Memo, in a job details table. I have a text box on a report which I need to print the contents of this field. My problem is that the text box will only display 255 characters. How can I get the report to print this field completely. Thanks for any help out there. John.
9
8167
by: philip | last post by:
If I execute that : Dim Temp as string = "This is a text" Dim sw As StreamWriter Dim fullFileName as string = "c:\text.txt" sw = New StreamWriter(fullFilename) sw.Write(temp) sw.Close() the resulting file 'Text.txt' has the same length than the string 'temp'.
1
3060
by: alexsg | last post by:
A little while ago Ron P kindly responded to my inquiry on how to copy the first line of memo field into a text field, using a query: left(,instr(1,,vbCrLf)-1) This is great, but I would like to do this on a form, so that the person entering the memo can use a button to paste the 1st line to a title (text) field. I'm having trouble setting up the code to do this. I'd also appreciate some ideas on how to get the 2nd and 3rd lines...
9
5743
by: RMC | last post by:
Hello, I'm looking for a way to parse/format a memo field within a report. The Access 2000 database (application) has an equipment table that holds a memo field. Within the report, the memo field is printed within the detailed area. The problem is, the apllication is not setup properly, thus the users are entering data within the memo field as: location1 1/1/2005 1/1/2006
15
7385
by: sara | last post by:
I have a Memo field in a table to hold notes from a conversation a social worker has had with a client (this is for a non-profit). If the user needs to update the memo field, I need to find the original record (which I am doing fine - getting the correct key) and I need to update the "notes" with the new value from the form, which I store in a String Variable. (I've tried storing in a Variant variable; didn't work for me)
0
9722
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9603
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10378
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10121
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9200
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7664
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6881
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3862
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.