Solved

String too long I guess!

Posted on 2002-03-26
4
325 Views
Last Modified: 2011-04-14
I use a procedure to create a listbox that shows all the queries in a database, so the user can select a query to run.

In testing, I ran into error 2176, something about "The text you are putting in this field is the wrong size, it must be either 255 or 2048 bytes...."  (I'm paraphrasing there!)

I set the list box for ROwSource=ValueList.

The DB I was using had LOTS of queries, so maybe the list was too big.  Anyway to handle this?  I suppose, the string I build containing queries, I could split into 200 char chunks, and display them thusly....And why do some queries come up with wierd names that I can't see in the DB window (things like ~sqqryWhatItIs).

Doug
0
Comment
Question by:dougp23
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Accepted Solution

by:
SE081398 earned 50 total points
ID: 6896641
I would tend to think that the value list can support up to 255 charactors. Dumb question but are you separating the values with semicolons?

another way to try this is by writing the names of the queries to a temp table and then set the controlsource of the list box to the temp table.  see if it displays.

with temptable
delete everything

keep the list box hidden(visible = false)
create a table with 1 field
loop through your querydefs and retrieve the names
write each name to the table

listbox.requery
listbox.visible= true

0
 
LVL 2

Expert Comment

by:mrt1
ID: 6896753
A list box can display a maximum of 255 entries, and each entry can be a maximum of 255 characters.
The character length shouldn't be an issue, because I don't think a query name can exceed 255 characters either.

The strange "~sqqry" entries are probably temporary querydefs that Access creates beind the scenes to help run your code. You should be able to filter out this entries using an SQL expression (e.g: SELECT *
FROM MSysQueries WHERE.....)
0
 
LVL 1

Author Comment

by:dougp23
ID: 6897075
Nice idea.  Yea, separated with commas.
I will do the table thing.  Thank you.
0
 
LVL 3

Expert Comment

by:SE081398
ID: 6897099
You're welcome.

If you need any more help doing this let me know.  I was brief in the explaination but I hope you got the idea.


SE


0

Featured Post

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
In Microsoft Access, learn how to “cascade” or have the displayed data of one combo control depend upon what’s entered in another. Base the dependent combo on a query for its row source: Add a reference to the first combo on the form as criteria i…
In Microsoft Access, when working with VBA, learn some techniques for writing readable and easily maintained code.

738 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question