473,554 Members | 3,078 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

VBA-excel,text box-enter event

15 New Member
hello i need help in this please. i dont have much knowledge of VBA but can do very basic things by learning from different forums.

i want to create one excel application where there will be few userforms. and on each there will be some text boxes.

i want it to work like this.
if user puts number 2 in textbox1 on userform1 and then PRESS ENTER, unload userform1 and show userform2, but if user puts 3 in textbox1 on userform1 and PRESS ENTER then unload userform1 and show userform3 and so on.......... pressing enter is very important event.

i have tried it with click event and it is working but it needs to be enter event.

thanks a lot.
ronak
Jan 23 '09 #1
4 14011
MikeTheBike
639 Recognized Expert Contributor
Hi

Have you tried the 'TextBox1_After Update' Event !?

MTB
Jan 23 '09 #2
ronakinuk
15 New Member
thanks for your reply

have tried the afterupdate event in the textbox, but that event is fired only if the form is closed by the user, it doesnt work with pressing enter key.

the code i tried was
Private Sub TextBox1_AfterU pdate()
If TextBox1.Text = "2" Then UserForm2.Show
If TextBox1.Text = "3" Then UserForm3.Show
End Sub

may be i dont know how to write the code, can you please help me with the code so that after putting 2 and pressing the enter key the userform1 will close and userform2 will show........... .and so on with 3, 4, 5.........till 10.

i have previously tried with userform1_click event like below.but it doesnt unload userform1 at the same time.

Private Sub UserForm_Click( )
If TextBox1.Text = "2" Then UserForm2.Show
If TextBox1.Text = "3" Then UserForm3.Show
End Sub

thanks
Jan 27 '09 #3
MikeTheBike
639 Recognized Expert Contributor
Hi again

I do not know why your code does not work but this
Expand|Select|Wrap|Line Numbers
  1. Private Sub TextBox1_AfterUpdate()
  2.     If TextBox1.Text = "2" Then UserForm2.Show
  3.     If TextBox1.Text = "3" Then UserForm3.Show
  4. End Sub
works OK on my PC (running Excel 2k3).

Perhaps some else can shed some light on this. I don't know if there are any setting in Excel/VBA to disable control event.

Do any of the forms or contols events work ??


MTB
Jan 28 '09 #4
Thanks a bunch MikeTheBike that solved a problem I had as well
Nov 10 '10 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

0
2050
by: andreas | last post by:
Hi there, I have the following situation: 1. DOT.NET Application is started 2. DOT.NET Application instantiates Access.Application.8 3. Opens a specified database (MDB) 4. DOT.NET application sets a global variable in the access application to itself (type object) 5. Runs a macro
1
1854
by: Igor Mendizabal | last post by:
Hello We have a VB6 application that integrates an VBA IDE from which the final user can make modifications. We want to pass the application to VB.NET, and the first step, before rethinking the whole application, is to pass the conversion wizard and see how it goes. But we want to keep those client VBA modifications working with the...
3
1752
by: DKJ | last post by:
Is VBA wholly and completely a subset of VB.net? Are there any objects or methods or coding techniques that one could learn in VBA that wouldn't also apply in VB.net? So if I will have learned VB.net, by definition, I will have learned VBA?
22
7090
by: Illya Havsiyevych | last post by:
Hello How easily parse VB/VBA code by VB/VBA code ? Is any ready solutions ? Thank's, illya
41
3057
by: Matt Alanzo | last post by:
Our SOHO 2 person compay sells furniture (not programmers). In '98 we paid $,$$$ for a VBA -Access '97 accounting application, including VBA source code .... an huge investment for us then (and now!). The application publisher went belly up years ago. Over time we've made a number of VBA code changes (< 500 lines total). Now our CPA is urging...
6
5497
by: Ieuan | last post by:
Hello all and Happy New Year, I've been having this problem for some time and thought I'd try to see if anyone else out there has had the same problem or can give a little help. I'm using a website written in C# to call a .dll which in turn returns a load of information. Most of this information is readable. However, some of the...
1
2354
by: Igor Mendizabal | last post by:
Hello We have a VB6 application that integrates an VBA IDE from which the final user can make modifications. We want to pass the application to VB.NET, and the first step, before rethinking the whole application, is to pass the conversion wizard and see how it goes. But we want to keep those client VBA modifications working with the...
18
2375
by: Ann Scharpf via AccessMonster.com | last post by:
I am not sure which would be the best place to post this question, so I'm posing it here with Access general questions. I have reached the point many times in Word and in Access where my ignorance of VBA is a real detriment to me. I saw some posts about VBA classes with a particular vendor and the poster was advised not to take the class...
15
4576
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never...
7
3704
by: fcolon75 | last post by:
I'm an experienced Access user, but very new to coding VBA in Access. I'd like to do the following: 1) Develop a basic query in the query designer. 2) Call that query from a VBA script 3) Manipulate the data from the results set in the VBA script (i.e. read data from fields into variables, etc.) This conceptually seems like it should be...
0
7570
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7493
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8008
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7526
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7854
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
1
5411
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3537
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
1
1107
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
808
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.