Reputation: 97
My Access 2007 app uses SQL as the back end. On a form we have list boxes. List boxes will not display the data if the data type is varchar (max). We are using 255, but this is not enough. Could someone tell me if there is a way to show more char's in a list box than 255.
Thanks
Upvotes: 1
Views: 2295
Reputation: 97111
AFAIK, there is no way to make a list box display more than 255 characters.
As a workaround, you could display the text in a text box control. A text box can hold up to 65,535 characters. (on the Access Blog: Access 2007 Limits)
Include a primary key as the bound column in your list box's rowsource, and display as much of the text as is reasonable. Then, in the form's On Current event and the list box's After Update event, retrieve the full text string associated with the list box's current primary key value and load that string into the text box.
You can use the DLookup Function for this.
Me.BigTextBox = DLookup("text_field", "YourTable", _
"pkey_field = " & Me.ListBoxName)
If the pkey_field is text rather than numeric data type, enclose the literal value with quote marks.
Me.BigTextBox = DLookup("text_field", "YourTable", _
"pkey_field = '" & Me.ListBoxName & "'")
Upvotes: 2