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 derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

getting contents of a field before updating

Status
Not open for further replies.

kbdci

Programmer
Jul 16, 2002
33
US
I want to be able to display the entire contents in a field when the number of characters exceeds the number that fit in the display area. When I try to do this using an On Change event, the field (variable = fieldname) contains only the characters (if any) that were there when the cursor entered the field (got focus). How can I get the current contents of the field after text has been added and before leaving the field?

Here is the code in the On Change event for a title field.

If KeyCode > 48 Then
intLength = Len(Me.txtTitle)
strTitle = Me.txtTitle
.
.
End If

No matter when I get the text string in Me.txtTitle, it is always the same as when the cursor entered the field. I want to get what it is after the field has been changed but while the cursor is still in the field.
Thanks.
 
try the BeforeUpdate() event, it sounds like what you are looking for.

if you want to cancel the update, then set cancel = true in BeforeUpdate.

HTH!

-Brad
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top