Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

String too long I guess!

Posted on 2002-03-26
4
Medium Priority
?
352 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 200 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

Free Backup Tool for VMware and Hyper-V

Restore full virtual machine or individual guest files from 19 common file systems directly from the backup file. Schedule VM backups with PowerShell scripts. Set desired time, lean back and let the script to notify you via email upon completion.  

Question has a verified solution.

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

This article shows how to get a list of available printers for display in a drop-down list, and then to use the selected printer to print an Access report or a Word document filled with Access data, using different syntax as needed for working with …
We live in a world of interfaces like the one in the title picture. VBA also allows to use interfaces which offers a lot of possibilities. This article describes how to use interfaces in VBA and how to work around their bugs.
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…
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …

636 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