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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to use a unbound control to pass more than 128 characters

Status
Not open for further replies.

omniaccess

Technical User
Feb 2, 2005
16
US
I have an unbound box that users can type in a note to save into the system. Then, they click on a button (Save Note to File) and a SQL statement runs in VB to save the note and other relevant data to a note table.

Everything has been working great, except when the note is greater than 128 characters. The database table it is going to is 255 characters per note, but when the unbound form has more than 128 characters in it, it gives an 'Invalid Argument' error message.

I am guessing it has something to do with the unbound box not having a saved format to it, such as character length, etc.

How do I solve this? I already have it programmed into vb that if len(TextEntryBox) >255 it will pop up a warning message to the client. I also have a box next to the entry box that shows how many characters they have typed in so far, so they can guage their typing.

I Thought of putting a bound text box on each form that the data would be entered from, but that brings up more issues when the users may edit the same record at the same time and see notes that one has entered BEFORE the original user created the note. Part of the security is having the Unbound text box to that it can be filled in easily on each person's workstation.

Any help of overcoming the 128 character limit of my text input box would be very helpful.
 
I found the answer to my own problem. Instead of referencing the input box directly in my SQL statement, I set up a string variable and assigned it to that.

Dim stNoteBox as String

stNoteBox = [InputtingTextBox]

Then, I also applied the replace command to allow people to put a ' in their text string

stNoteBox = Replace(stNoteBox, "'", "''")

Now, everything works as planned. If longer than 255 characters, they get a yes/no message box asking if they would like to edit it or have the computer truncate it to 255 characters for them. And it works correctly.

If this helps anyone else, great.

Thomas

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top