Tab chars in memo fields on form

madmike

New member
Local time
Today, 13:21
Joined
Sep 10, 2020
Messages
2
I have an Access 2010 system that stores program source code. (PostScript, but that is not relevant to this problem) in a table as a memo field. It works fine except that forms showing the source code donn't deal with tab chars by indenting, as one would expect. <CR> and <LF> are fine. But not tab char.

The table contains the tab chars OK (and I can, for example) generate HTML by replacing each tab char by 3 &nbsp; html chars.

But I would like to be able to edit the source code on a form, using a control that deals with the tab char properly, including showing them, indenting, allowing insertion/deletion, ... I can obviously do all that with (for example) Notepad ++. But I need to be able to do it with code in the tables.

Is this possible? And if so, how?

Thanks for any help, Mike
 
have you tried setting your memo field to rich text?
 
Yes. If I do that, even the <CR><LF> characters get ignored.

I will prototype the following approach:

1. When a record becomes the current record, convert all <tab> chars to 3 spaces and set 'dirty' to false
2. Allow spaces to be inserted; if any change is made to the field, set dirty to true
3. When the record needs to be saved/closed, check dirty; if it is true, convert spaces back to <tab> characters (after dividing the number of contiguous blanks by 3 of course)

Clumsy. But I think it should work. Obviously, the depth of indexing can be changed by swapping 3 to 4 (for example) in a global database variable.

Does anyone have a simpler solution?
Regards, Mike
 
If I do that, even the <CR><LF> characters get ignored.

Rich text uses html code and you can't mix the two

see post#3 in this link for determining the required html code


other thing to try is using vbTab
 
Last edited:

Users who are viewing this thread

Back
Top Bottom