473,378 Members | 1,607 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

VBA-excel,text box-enter event

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 14001
MikeTheBike
639 Expert 512MB
Hi

Have you tried the 'TextBox1_AfterUpdate' Event !?

MTB
Jan 23 '09 #2
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_AfterUpdate()
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 Expert 512MB
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
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...
1
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...
3
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...
22
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
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...
6
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...
1
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...
18
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...
15
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...
7
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)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.