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

Using KeyPress event

Status
Not open for further replies.

countdrak

Programmer
Joined
Jun 20, 2003
Messages
358
Location
US
I am using VBA with our ERP software. I have a form in VBA with a textfield. When the form kicks in the field is populated with a string.

I wanna do a couple of things. Firstly - I want the string to be highlighted when the form comes up.

Secondly, The string that is in my text field has to be copied to the db, I already have the code to write the string to a db, but after writing the string to a db I want to unload the form but I [red]cannot[/red] have a submit button on the form to do this. I want to copy the string to a db and unload the form When the user hits TAB.

I know how to write the value to the db, but I could not find a Lose_Focus event for my text box in this form, I guess its not available. So I was trying to use the KeyPress event, How do I catch the TAB and unload the form?

Here is the code I have --
Code:
   txtBno is the text field. 

    Load frmBNo
    frmBinNo.txtBno.Text = "some string"
    frmBinNo.Show
 
Doesn't has txtBno an AfterUpdate event procedure ?

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top