Clearing 1 or 2 characters in a field & not retype all the charact

L

luv2bike2

I have an Access 2003 DB that was put into place before I started this job.
I have very little experience in Access (all versions). any way, my users
enter a number in a box that they only have to enter part of the number and
click "find a document" button that displays the documents below. they like
that part, however what they don't like and they are wondering if i can fix
this part.... when they go into the box enter the whole number and pull up
the document, find what they want and than go back to that box where they put
the whole number in and just want to change the number say from 123456 to
123457 the box clears out and they have to retype the number in. they just
want to delete the 6 and replace it with 7. is that possible?

I don't know if this will help out, I have gone into the form design of the
DB and the box that the users put in the number in says "unbound" (without
the quotes). I am unsure of what "unbound" means.
 
L

luv2bike2

added information....
once the user places the cursor in the box the text that was already there
clears out. we don't want that to happen, we just want to take away a
character or two and place it with a character or two.
 
F

fredg

I have an Access 2003 DB that was put into place before I started this job.
I have very little experience in Access (all versions). any way, my users
enter a number in a box that they only have to enter part of the number and
click "find a document" button that displays the documents below. they like
that part, however what they don't like and they are wondering if i can fix
this part.... when they go into the box enter the whole number and pull up
the document, find what they want and than go back to that box where they put
the whole number in and just want to change the number say from 123456 to
123457 the box clears out and they have to retype the number in. they just
want to delete the 6 and replace it with 7. is that possible?

I don't know if this will help out, I have gone into the form design of the
DB and the box that the users put in the number in says "unbound" (without
the quotes). I am unsure of what "unbound" means.

And how does Access know that you wish to replace the last character
only, as opposed to, say, the third character?

Look up the SelStart property in VBA help.
If you always wish to place the cursor just before the 6th character,
then code the Control's Enter event:
Me.[ControlName].SelStart = 5

If it's always the last character to be replaced, then
Me.[ControlName].SelStart = Len([ControlName])-1

The above code ONLY works if you tab into the control. If the user
enters the control using the cursor, the cursor position will be
wherever the cursor was placed in the control.
 
L

luv2bike2

Fred,

Thank you for responding. However I am not sure where to find SelStart in
VBA. I am very new to Access and I am confused. I believe once i find the
line that you mentioned I will be able to correct this issue that my users
are having. I have an Access 2003 Dummies book and looked up Selstart and
its not there.

They usually will replace the last couple of characters, it could be the
last one or the last 2 or 3. they just don't want to retype the whole thing.
--
Thank you,



fredg said:
I have an Access 2003 DB that was put into place before I started this job.
I have very little experience in Access (all versions). any way, my users
enter a number in a box that they only have to enter part of the number and
click "find a document" button that displays the documents below. they like
that part, however what they don't like and they are wondering if i can fix
this part.... when they go into the box enter the whole number and pull up
the document, find what they want and than go back to that box where they put
the whole number in and just want to change the number say from 123456 to
123457 the box clears out and they have to retype the number in. they just
want to delete the 6 and replace it with 7. is that possible?

I don't know if this will help out, I have gone into the form design of the
DB and the box that the users put in the number in says "unbound" (without
the quotes). I am unsure of what "unbound" means.

And how does Access know that you wish to replace the last character
only, as opposed to, say, the third character?

Look up the SelStart property in VBA help.
If you always wish to place the cursor just before the 6th character,
then code the Control's Enter event:
Me.[ControlName].SelStart = 5

If it's always the last character to be replaced, then
Me.[ControlName].SelStart = Len([ControlName])-1

The above code ONLY works if you tab into the control. If the user
enters the control using the cursor, the cursor position will be
wherever the cursor was placed in the control.
 
Top