473,804 Members | 1,971 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 14024
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
2068
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
1871
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 least
3
1765
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
7127
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
3098
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 us to switch to Quickbooks Premier for Contractors at a cost of $,$$$ plus data entry. Argh, no...
6
5513
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 information returned is of type VBA.CollectionClass.
1
2366
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 least
18
2403
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 because of the likelihood of an unskilled trainer. My question is, would taking a Visual Basic...
15
4650
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 before needed to do this HTTP/XML/MySQL type functions.
7
3718
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 an easy thing to do. However, I'm finding it difficult to find articles or postings on the subject.
0
9711
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9593
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10595
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10088
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6862
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5529
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4306
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3831
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3001
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.