PDA

View Full Version : Solved: Still wondering - is there a way to set tabs in a Text Box??



ctengelen
10-31-2005, 02:45 PM
Hi All,

I just found out that I still have a need to be able to set Tabs in a Text Box. The attached form would explain it a bit better than I can.

:dunno I really do not know. If there is a way.

Please help.

Trudy

Killian
10-31-2005, 03:26 PM
Hi Trudy,

I believe the short answer is "no". :(

A textbox just collects character codes and displays them in-line (although there's some font formatting available). AFAIK there's no property available to set.
A determined coder would probably argue that you could force the issue by intecepting a tab with the keypress event, backspacing and counting back the length of that entry and inserting spaces (with each field therefore needing a max size) etc - there are a few headaches to deal with along the way, I'd be surpised if it worked very well...

Looking at the form, would it not be better to have those entries as individual text boxes? You can always change the properties on the textboxes and labels (borders, specialeffect, etc) to give it more of a "table" feel.

ctengelen
10-31-2005, 03:41 PM
Hi Killan,

I thought so - that there is no way to set tabs in a text box (would be nice though), but I had to ask.

To place the information in individual text boxes would be great IF we would always know how many entries there are!! There could be only 1 or there could be 10+. This is why I have the table with the bookmarks copied and inserted as often as needed.

I think the only way around that is to put the 'charges' part of my table at the end of the unpotected area and the user can then just use the TAB key to insert a new row and carry on.

And after they are done and need a new warrant entry - the routine would be the same, insert (copy) the table and once the dialog box has populated (dumped) the text into the table, they use the TAB key to carry on.

Or can you find another way??? Im still somewhat a greenhorn in VBA coding, but I am learning quick.

thanks for your quick response.

Trudy

fumei
11-01-2005, 10:29 AM
I am not seeing the form. Is there a file attached here somewhere????

ctengelen
11-01-2005, 10:44 AM
Hi Fumei,

I just re-loaded the attachment. I hope you can see it now.

Trudy

ctengelen
11-01-2005, 10:50 AM
Hello again,

The problem I am facing that I do not know how many of the warrants there are at any given time - this is why I have the table part copied and inserted as often as needed. At the same time - we do not know how many charges are there on each warrant.

Is there any other way I could takle that problem?????? :banghead:

Trudy

Killian
11-01-2005, 12:31 PM
Well I guess another way would be to have a slightly different interface, where you enter the data into 5 textboxes and then add that 5-item record to a listbox. Then you can build up the list and add it all as a table when you're done.
That way you can have your labels (column headings), txtboxes(entry field) and listbox columns all the same width.
I've attached an working example

ctengelen
11-01-2005, 01:58 PM
Hi Killian,

I think I am going crazy.....I tried out the Doc1.doc with the form and it worked out just great there......no I am trying go go back to the form to see how to implement it into my form - and the little beast is not inserting a new table nor is it inserting any data...What??? did I do??? I did not change the macro in any way. I re-opened a new copy from your post - still the same result.

I am sooooooo confused.

Trudy

Killian
11-02-2005, 06:39 AM
Well you're not going crazy - you needed to change the code a little - or at least match the objects on the form to the code. It was a little complicated - I've amended you're form and matched up the control names to the code and added to "Done" code to your "OK" code and it seems to work.
I ended up making a table of the column headings and moving the bookmark into it so now the code adds the appropriate number of rows to that table, formats them and then adds the data, so it's changed a little, but the principles still the same :)

ctengelen
11-02-2005, 02:44 PM
Hi Killian....

This is me now: :cloud9:

With a bit of juggling and tweeking and whatnots...Thanks to your help..the form is DONE.
:beerchug:

Thank you====Thank you!!! :bow: You folks are AWESOME!!!!!

I am learning so much from reading and asking. This has to be the most useful forum that one can get help in.

I hope withing a few months of learning I could be able to give someone like me (today) a leg up.

Thanks again.

Trudy

MOS MASTER
11-03-2005, 03:48 PM
Nice sollution to this problem K! :)