Re: How to insert a '*' in certain controls when Enter is pressed.



Use SelStart to determine where the cursor is.

--
Allen Browne - Microsoft MVP. Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"ThomasAJ" <ThomasAJ@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:934DF817-8DEF-4451-B546-99396E3052B4@xxxxxxxxxxxxxxxx
There could be many other NEW LINES either before or after the location of
where the NEW new line is called for. In other words the '*' must be inserted
AFTER where the NEW new line is created.

The end result is to look like:
* blah blah1
* blah blah2
* blah blah3
* blah blah4

--
Regards
Tom


"Minton M" wrote:

On Jan 4, 7:41 pm, ThomasAJ <Thoma...@xxxxxxxxxxxxxxxxxxxxxxxxx>
wrote:
> An important user wants to have a '*' inserted at the beginning of a > NEW LINE
> in certain controls when the ENTER key is pressed.
>
> OK so in the Form_KeyDown event I can determine if the enter key has > been
> pressed, and I also know the name of the ActiveControl. The controls in
> question have the NewLine property set to YES.
>
> So how to insert a '*' at the beginning of the new line. I have tried > some
> silly code in the Form_KeyDown event but I think it is the wrong place > to go
> changing control text.
>
> Also bear in mind that the ENTER key may have been pressed in the > middle of
> existing text and not just at the end.
>
> --
> Regards
> Tom

In the control's keypress event, use Replace to search for the newline
character and replace with a * followed by a new line. Don't forget to
use the Text property of the Textbox rather than the value property.

-- James


.



Relevant Pages

  • Re: How to insert a * in certain controls when Enter is pressed.
    ... Allen Browne - Microsoft MVP. ... blah blah1 ... in certain controls when the ENTER key is pressed. ... question have the NewLine property set to YES. ...
    (microsoft.public.access.formscoding)
  • Re: How to insert a * in certain controls when Enter is pressed.
    ... blah blah1 ... in certain controls when the ENTER key is pressed. ... question have the NewLine property set to YES. ... silly code in the Form_KeyDown event but I think it is the wrong place to go ...
    (microsoft.public.access.formscoding)
  • Re: Can attributes of tables/relationships, etc. be changed programatically?
    ... Tips for Access users - http://allenbrowne.com/tips.html ... I CONSTANTLY have to unhook the relationships I've built via the Relationships tab on Tools, then change the Required element of a few controls on a table from yes to no, make some other adjustments to the attributes of various controls, then copy just the structure to another name, delete the first table, rename the new table to what it should be, import some data, run some queries that find duplicates, missing data, deletes some garbage, etc. ... The terrible part is, my boss is going to eventually want to take this existing mdb and make one identical too it but with only certain of the tables populated with some data and defaults and things, leaving the rest of the tables empty, and make a new mdb with it. ...
    (comp.databases.ms-access)
  • Re: Parameter Query Form Problem
    ... Tips for Access users - http://allenbrowne.com/tips.html ... This is what I used to make my query, its was a Microsoft support site. ... controls on the form so it can run the query. ... Combo Box for searching Customer Name ...
    (microsoft.public.access.formscoding)
  • Re: New Record Not Saving
    ... The user needs to type something into one of the controls on the form before ... Tips for Access users - http://allenbrowne.com/tips.html ... "John H W" wrote in message ... Exit Sub ...
    (microsoft.public.access.formscoding)