Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

String data type question

Status
Not open for further replies.

gymbeef

Technical User
Sep 18, 2002
33
US
The Help files say that String variables come in two types - variable length and fixed length. But pretty much every other reference to strings talks about them as though they are always variable length. How do you tell whether a string is fixed-length or variable? How do you define a string as one or the other? When you declare a string using Dim, Private, Public (e.g., Dim strName as String), those are variable length right? Then how do you define a string as fixed? I can't find any information on setting fixed length strings. I'm working with some large memo files and I want to be sure I don't accidentally truncate them.

Thanks in advance.
 
You can assign the value of a memo field to a string variable, no problem. Worries:

1. Don't assign memo fields to listbox/combobox controls, as they truncate the string to 255 characters.
2. Textboxes, on the other hand, are fine. Use them.
3. Just be careful using memo fields (or any text field) and straight SQL, as single-quotes inside a memo field will mess up the SQL syntax unless properly surrounded by Chr(34) characters, i.e.
Code:
"etc. WHERE FUN_VAL = '" & rs!MEMO_FLD & "'"
Code:
ERROR: INSTANT AND PAINFUL PROGRAM DEATH
Code:
"etc. WHERE FUN_VAL = " & Chr(34) & rs!MEMO_FLD & Chr(34)


That's all the issues I can think of right now.

--
Find common answers using Google Groups:

Corrupt MDBs FAQ
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top