If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
" - Quotes
Hi All,
I'm trying to display a note in a text box. The line of code is simply: txtNote.ControlSource = "=" & Chr(34) & ListNotes.SelectedItem. & Chr(34) the problem is that anytime the note itself has a " in it, it causes an error. Are there any creative ways around this? Thanks, Steve |
#2
|
|||
|
|||
" - Quotes
Use the Replace function to change any instance of a double quote in the
text to two instances of a double quote. txtNote.ControlSource = "=" & Chr(34) & Replace(ListNotes.SelectedItem, Chr(34), Chr(34) & Chr(34)) & Chr(34) -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "SC" wrote in message ... Hi All, I'm trying to display a note in a text box. The line of code is simply: txtNote.ControlSource = "=" & Chr(34) & ListNotes.SelectedItem. & Chr(34) the problem is that anytime the note itself has a " in it, it causes an error. Are there any creative ways around this? Thanks, Steve |
#3
|
|||
|
|||
" - Quotes
In ,
SC wrote: Hi All, I'm trying to display a note in a text box. The line of code is simply: txtNote.ControlSource = "=" & Chr(34) & ListNotes.SelectedItem. & Chr(34) the problem is that anytime the note itself has a " in it, it causes an error. Are there any creative ways around this? Doug gave you an answer that solves the problem with the quotes, but I'm curious: is there a reason you're setting the text box's controlsource expression, binding the text box on the fly to a static expression, rather than leaving the text box unbound and just setting its value to the text of the note? E.g., txtNote = ListNotes.SelectedItem -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
#4
|
|||
|
|||
" - Quotes
Thanks
"Douglas J. Steele" wrote: Use the Replace function to change any instance of a double quote in the text to two instances of a double quote. txtNote.ControlSource = "=" & Chr(34) & Replace(ListNotes.SelectedItem, Chr(34), Chr(34) & Chr(34)) & Chr(34) -- Doug Steele, Microsoft Access MVP http://I.Am/DougSteele (no private e-mails, please) "SC" wrote in message ... Hi All, I'm trying to display a note in a text box. The line of code is simply: txtNote.ControlSource = "=" & Chr(34) & ListNotes.SelectedItem. & Chr(34) the problem is that anytime the note itself has a " in it, it causes an error. Are there any creative ways around this? Thanks, Steve |
#5
|
|||
|
|||
" - Quotes
You are 100% correct. The text box should remain unbound. I made this change.
"Dirk Goldgar" wrote: In , SC wrote: Hi All, I'm trying to display a note in a text box. The line of code is simply: txtNote.ControlSource = "=" & Chr(34) & ListNotes.SelectedItem. & Chr(34) the problem is that anytime the note itself has a " in it, it causes an error. Are there any creative ways around this? Doug gave you an answer that solves the problem with the quotes, but I'm curious: is there a reason you're setting the text box's controlsource expression, binding the text box on the fly to a static expression, rather than leaving the text box unbound and just setting its value to the text of the note? E.g., txtNote = ListNotes.SelectedItem -- Dirk Goldgar, MS Access MVP www.datagnostics.com (please reply to the newsgroup) |
Thread Tools | |
Display Modes | |
|
|