how to populate unbound text box with only first two letters of user name

H

heidii

Hello:

I have a form where after selecting the appropriate ranch from a combo
box it updates an bound text box with the currentuser() name. I would
like it to populate the bound box with only the first two letters of
the currentuser() name. I have tried setting the length in the
underlying table to 2 characters. This works to an exteption. After
the afterupdate event runs on my combo box I get a message Runtime
Error -2147352567 stating that the value entered is too large for the
text box. I hit end or debug and it puts the two charactes in place
as I desired. How can I make this Runtime Error not show up at all or
just grab the first two characters of the Currentuser() name on the
afterupdate code.

Here is what I have on my afterupdate code:

Private Sub COMBORECLOTNUMBER_AfterUpdate()
Me.RECAREAID = Me.COMBORECLOTNUMBER.Column(2) 'select area id place
in text box
Me.RECUSERID = CurrentUser() 'select user id and place in text box
End Sub

Thanks for any help.

heidi
 
M

Marshall Barton

heidii said:
I have a form where after selecting the appropriate ranch from a combo
box it updates an bound text box with the currentuser() name. I would
like it to populate the bound box with only the first two letters of
the currentuser() name. I have tried setting the length in the
underlying table to 2 characters. This works to an exteption. After
the afterupdate event runs on my combo box I get a message Runtime
Error -2147352567 stating that the value entered is too large for the
text box. I hit end or debug and it puts the two charactes in place
as I desired. How can I make this Runtime Error not show up at all or
just grab the first two characters of the Currentuser() name on the
afterupdate code.

Here is what I have on my afterupdate code:

Private Sub COMBORECLOTNUMBER_AfterUpdate()
Me.RECAREAID = Me.COMBORECLOTNUMBER.Column(2) 'select area id place
in text box
Me.RECUSERID = CurrentUser() 'select user id and place in text box


Me.RECUSERID = Left(CurrentUser(), 2)
 
H

heidii

heidii said:
I have a form where after selecting the appropriate ranch from a combo
box it updates an bound text box with the currentuser() name. I would
like it to populate the bound box with only the first two letters of
the currentuser() name. I have tried setting the length in the
underlying table to 2 characters. This works to an exteption. After
the afterupdate event runs on my combo box I get a message Runtime
Error -2147352567 stating that the value entered is too large for the
text box. I hit end or debug and it puts the two charactes in place
as I desired. How can I make this Runtime Error not show up at all or
just grab the first two characters of the Currentuser() name on the
afterupdate code.
Here is what I have on my afterupdate code:
Private Sub COMBORECLOTNUMBER_AfterUpdate()
Me.RECAREAID = Me.COMBORECLOTNUMBER.Column(2) 'select area id place
in text box
Me.RECUSERID = CurrentUser() 'select user id and place in text box

Me.RECUSERID = Left(CurrentUser(), 2)

--
Marsh
MVP [MS Access]- Hide quoted text -

- Show quoted text -

Thanks that worked great.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top