Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Finding parts of a textbox

Status
Not open for further replies.

caman74

IS-IT--Management
Jan 1, 2005
67
NO
Hello.

I have a textbox "txtNumber" that contains either two or eight characters (numbers).
I also have a textbox called "txtDep".
Both textboxes are placed in the form "frmTrspInv".

What I want is when "txtNumber" loses focus it will copy the first two characters into "txtDep".

I know this is a simple task, but I've been working to mutch with FileMaker lately, so I've startet forgetting Access.

Christian
 
You can try like this...

Code:
Private Sub txtNumber_LostFocus()
   If Not IsNull(me.txtNumber) = True and Len(Trim(me.txtNumber)) >= 2 Then
      me.txtDep = MID(me.txtNumber,1,2)
   End If
End Sub

Regards,
 
Thanks.

Exactly what I was looking for!

Christian
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top