text box on exit

I have validate code on text box and want to cursor get back text box.

I use Screen.ActiveControl.SetFocus, but the cusor goes to where my mouse 
click.

Are there any way to let cursor stay in the text box until user enter valide 
data?


Your help is great appreciated,
0
Utf
3/12/2008 6:43:02 PM
access.formscoding 7493 articles. 0 followers. Follow

2 Replies
946 Views

Similar Articles

[PageSpeed] 53

On Wed, 12 Mar 2008 11:43:02 -0700, Souris wrote:

> I have validate code on text box and want to cursor get back text box.
> 
> I use Screen.ActiveControl.SetFocus, but the cusor goes to where my mouse 
> click.
> 
> Are there any way to let cursor stay in the text box until user enter valide 
> data?
> 
> Your help is great appreciated,

Use the Text control's BeforeUpdate event to validate the data.

If IsNull(Me.[ControlName]) or Me.[ControlName] = "WrongData" then
	MsgBox "Wrong Entry."
	Cancel = true
End If


-- 
Fred
Please respond only to this newsgroup.
I do not reply to personal e-mail
0
fredg
3/12/2008 7:04:48 PM
thanks millions,


"fredg" wrote:

> On Wed, 12 Mar 2008 11:43:02 -0700, Souris wrote:
> 
> > I have validate code on text box and want to cursor get back text box.
> > 
> > I use Screen.ActiveControl.SetFocus, but the cusor goes to where my mouse 
> > click.
> > 
> > Are there any way to let cursor stay in the text box until user enter valide 
> > data?
> > 
> > Your help is great appreciated,
> 
> Use the Text control's BeforeUpdate event to validate the data.
> 
> If IsNull(Me.[ControlName]) or Me.[ControlName] = "WrongData" then
> 	MsgBox "Wrong Entry."
> 	Cancel = true
> End If
> 
> 
> -- 
> Fred
> Please respond only to this newsgroup.
> I do not reply to personal e-mail
> 
0
Utf
3/12/2008 8:01:03 PM
Reply:

Similar Artilces:

Printer does not print all text
For some reason one of my Publisher file is not printing all the text; only about 75% of the text is there. I have tried to print from a different computer but have the same problem. On screen, everything looks right and great. I am using Publisher 2007. Andy help would be appreciated. You might want to check the manufacturer's web site of your printer model for an upgraded driver. If you think your present driver is correct, uninstall it and then re-install. It is always wise to completely remove a printer driver before installing/reinstalling. How to clean up printer drivers...

Navigate to a particular link doesnot display the text sometimes
Have used navigate method of IWebBrowser2 in a property page to display the htm file. Debug prints shows the correct path is given for a link ( eg path for one of the hyper links path is C:/../team_typesENU.htm#aft) inside htm file . Sometimes the contents of the file does not get displayed .Contents are shown only when clicked on the control itself or navigate between the pages. text is hidden. anybody can let me know why is this happening ? ...

Wrap Text for Merged Cells
Hi, Can somebody post some good VBA macro for wrapping text in case of merged cells (merged rows as well as merged colums or both merged rows and columns). Lot has been posted in this regard till now but i could'nt find any perfect solution to this. Please help. Mvrk If you've seen lots of code that has been posted, yet you don't say what makes that code "not perfect", how do you expect anyone to respond to your post? Should responders just guess what "perfect" means to you? Try posting back with more information - what you've tried, why it didn...

How do I move text to beside (rather than after) a photo?
I have MS Word 2007. When I place a photo or text box onto a page, I can't then get text to enter beside it. The cursor will only go to the side just above or below the photo. How do I enter text alongside the picture? Change the text wrapping on the photo or text box to Square. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA http://word.mvps.org "Mrs Mainster" <Mrs Mainster@discussions.microsoft.com> wrote in message news:5C43DF85-E305-4DEC-8F8A-3BF1D544FF62@microsoft.com... >I have MS Word 2007. > When...

Outlook Express 6 change text format to HTML
All my incoming mail is plain text, and I've tried everything to my knowledge to convert my email to receive html format. All my emails usually come in HTML format from before. Does anyone know how to fix this on the OE6 version? Thanks. All is okay!!! I found the answer on another email and it worked fine. >-----Original Message----- >All my incoming mail is plain text, and I've tried >everything to my knowledge to convert my email to receive >html format. All my emails usually come in HTML format >from before. Does anyone know how to fix this on the OE...

Toolbar buttons (text and bitmaps) are disappearing, when using with MFC CToolBar class
Guys, help me to sovle the following problem I have a MFC SDI application (Vc++ 6.0) ( 2 Threads, UI and data acqusition thread). The UI is having a simple toolbar control with text and bitmap. The problem is once i run this application after doing some gui operation (like invoking some dialog box changing to diffrent view) the toolbar button is getting disappeared. sometimes the fonts of the toolbar button is getting changed or sometimes when i move the mouse over the toolbar, the buttons is slowly going away( only back ground color of rebar is comming. Is there any methods to debug this ki...

What is the formula to convert a whole column containing date to text?
What is the formula to convert a whole column of date to text? If I am to do it cell by cell, I need to press F2 then put a --> ' in front of the date. Is there a way I can do it with formula? I have tried CONCATENATE to combine column a which contains ' with date 12/31/03. Column A Column B ' 12/31/03 =CONCATENATE(A1,B1) However, the end result I got is as follow. '37986 instead of '12/31/03 Please help! Hi Caine one way: =TEXT(A1,"mm/dd/yyyy") where A1 stores your date value. Copy this down ...

Message Boxes
When displaying a message box how do you insert rows, carriage returns and place bullit points on left hand side of box. I've seen how to do it somewhere and I know it's dead simple but can't remember where!!! Thanx all!!! Mikey, Use the concatenate operator, &, with the Chr(10) (line feed) code: MsgBox "First line" & chr(10) & "Second line" To keep the code cleaner-looking, you may want to use the form: MsgBox "This is the first line" & Chr(10) & _ "This is the second" & Chr(10) & _ "And the fina...

Line Item Comment Text On Forms
Good morning. I am trying to get the line item comment text to appear on my Sales Transaction entry forms (i.e. quotes, orders, and invoices). At present, this field shows but only 4 lines of text and only so wide. I would like to get infinite lines of text with the field growing or shrinking as need be on the form. Would appreciate any advice here. cheap ugg > On Tuesday, July 26, 2011 10:50 AM Mark Plaideau wrote: > Good morning. > > > > I am trying to get the line item comment text to appear on my Sales Transaction entry forms (i.e. quotes, orders, and invoi...

Create chart from List Box
How do I use a List Box, with the months in it, allowing the user to click on a month and pull up that particular chart? Do I have to create several charts and use the list box as a hyperlink or can I have the chart create itself? TIA, Brenda Jon Peltier has instructions on his web site that may help you: http://www.geocities.com/jonpeltier/Excel/Charts/ChartByControl.html Brenda wrote: > How do I use a List Box, with the months in it, allowing > the user to click on a month and pull up that particular > chart? Do I have to create several charts and use the > list b...

Changing Yes/no box to combo box
I have a table that contains a field that is the data type Yes/no. Instead of having the traditional checkbox I am opting for the combo box. I have changed the display control to Combo box however when i go to add this to my form it does not have a drop down with yes or no....I know there is something little i must be missing. Another question is if i change it to this type of design is my code still going to be if me.xxx = True Then.....or will it change to if me.xxx = -1 Then? Thanks for your help as all my database just utilize the checkbox yes/no feature and not the combo box fe...

Disappearing text
Previously inserted text disappears and blinks on the screen, then disappears again. How and where do I find it? I would look for a video driver upgrade from the manufacturer's web site. -- Mary Sauer MS MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Dismayed" <Dismayed@discussions.microsoft.com> wrote in message news:A9CBBF8E-CA4B-455A-B29F-869B03F796F6@microsoft.com... > Previously inserted text disappears and blinks on the screen, then disappears > again. How and where do I find it? ...

Enable Combo box based on value in check box and list box....
I am working in Excel 2003 As a part of my worksheet titled "Worksheet" I am trying to enable Combo boxes based on the value of a check box and the value in a list box. There will be a total of 6 combo boxes on the Worksheet. The first combo box that deals with the body of a book will by default enabled. The second combo box will be set to appear disabled unless a forms control check box is checked to indicate there will be a cover on the book. The 3rd through 6th combo box will each be disabled by default and will be enabled when the list box which indicates the additional sect...

Convert text to Combo
Hi, I have some 20,000 entires populating a text filed that ideally should be a combo box. I'm looking for the best way forwards with this and wonder if there is any alternatives for what I need to do. The data in the text field needs to be restricted to a small number of options, I'm thinking that I need a combo box for this but then the original data will be in a different field. Is it possible to create a new combo box and then populate it with the data from the text field retrospectively or is there some other way forward for this problem? I would be very gra...

Change Text Case to Upper in a cell range A2:A92
I have a workbook of Contacts. In column A there are Names. I wish to convert those to UPPER case. I've seen a few VB codes that change the case to UPPER if I change something in the cell, GREAT if I want to go through the entire Column and change something. But is there another way? "Barry" wrote: > I have a workbook of Contacts. In column A there are Names. I wish to > convert those to UPPER case. I've seen a few VB codes that change the case > to UPPER if I change something in the cell, GREAT if I want to go through > the entire Column and change s...

Printing w/o text boxes
Is it possible to set up individual sheets to print without the text boxes included? We have instructions that we would like not to print. Select the area(s) you do want to print and then go File>Print Area>Set Print Area when you save this information will remain with the file. "GJR3599" wrote: > Is it possible to set up individual sheets to print without the text boxes > included? We have instructions that we would like not to print. Select your text boxes. If you have lots & lots of them, you can do this quickly by pressing the F5 key, clicking on the Spec...

TEXT function international dates
Hi I have a workbook that uses the formula TEXT(mydate, "mmm-yy") to convert dates into text strings. In my English version of Excel it is working fine. The problem is that I share this spreadsheets with users that have a French version of Excel and for them it's not working right. The referenced cell say '01/03/09' displays 'Mar-09' for me, whereas for them it will be 'mar-aa'. --French format for dates is 'jj/mm/aa' instead of 'dd/mm/yy'. Is there any solution? I do need to keep the text conversion as I use the result to concaten...

Group box, option button and cell reference
I need option buttons across six rows. I need the user to only have one option PER row. Help feature says to place option buttons into a Group Box but I can't figure out how to do that. It also says to have cell reference???? Any suggestions? If you use the option buttons from the Forms toolbar rather than the Controls toolbar, you can place them inside a group box (also from the forms toolbar). Right-click the option button and choose Format control. In the control tab, enter a cell reference to contain the value of the option button(which will be 1-6 for 6 buttons within the ...

combo box #21
I need to create a combo box and would like to use the control box. Can anyone guide me to a good tutorial? hi, try this. if the home page comes up, type in combo box in the keyword box http://www.exceltip.com/se/combo_box.html regards FSt1 "ReneeR" wrote: > I need to create a combo box and would like to use the control box. Can > anyone guide me to a good tutorial? ...

Combo Boxes in CListCtrl
Hi, How shall I have combo boxes as CListCtrl subitems? Regards, Vinodh Kumar P See here: http://www.codeproject.com/listctrl/xlistctrl.asp "Vinodh Kumar P" <thecomdeveloper@yahoo.com> wrote in message news:bltlo1$e7h$1@news.mch.sbs.de... > Hi, > How shall I have combo boxes as CListCtrl subitems? > > Regards, > Vinodh Kumar P > > ...

nonfunctioning cbo box
Hi; Second time I'm asking this question, and hope someone can suggest a cure. I'm running a form with a cbo box for data entry. I have 5 other BASICALLY IDENTICAL cbo's on the form, all of which work fine. My NotOnList event is as follows: ' Add a new policy type by typing a name in ' CoPolicy Type combo box. Dim NewCoPolicyType As Integer, TruncateName As Integer, Title As String, MsgDialog As Integer Const MB_OK = 0 Const MB_YESNO = 4 Const MB_ICONQUESTIONMARK = 32 Const MB_ICONEXCLAMATION = 64 Const MB_DEFBUTTON1 = 0, IDYES = 6, IDNO =...

a macro to PROPER text
I would like a macro that would set the "proper" format for the cell selected. Thanks Hi Sub SetProper() Dim c As Range For Each c In Selection c.Value = WorksheetFunction.Proper(c.Value) Next End Sub -- Regards Roger Govier "pcor" <pcor@discussions.microsoft.com> wrote in message news:DC3A20F6-4A19-4D8D-B2D5-655BCB12B644@microsoft.com... > I would like a macro that would set the "proper" format for the cell > selected. > Thanks Thanks. That worked very well. I had thought that to use this macro I could replace &quo...

How to convert text in a graphic file into normal text that MSWord
I have text in a jpec or gif file. How do I convert that to normal text that MSWord can process? You'd have to use OCR software (Optical Character Recognition). Office comes with something called Microsoft Document Imaging, which does a pretty decent job, but it only reads a limited number of graphics formats (I had to convert jpg's to tif's). It may not have been installed on your computer by default -- you may have to get out your Office distribution disk. My HP all-in-one also came with OCR, but I haven't found a way to get it to read a file that it didn't j...

Modifying linked text boxes?
I have Publisher 2003 document that has linked text boxes that cover about 4 and a half pages. The first text box starts at the bottom half of a page. What is the easiest way to change the linked text boxes so that it starts at the top of the next page. In other words, I want to eliminate the first text box at the bottom half. I cannot break the link on the text box and delete it. The text is elimated in the other boxes. If I try to squish the text box, then the text overflows to the next page and I almost have what I want, but I still have a small remnant of the squished box on the...

Counting BOLD text
Can anyone please advise me how I can count only the "BOLD"[B]" text i a column??? I cannot sort the column, it will mess up the integrity.. HELP?? ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com try Sub countbold() For Each c In Selection If c.Font.Bold = True Then _ boldcount = boldcount + 1 Next MsgBox boldcount End Sub -- Don Guillett SalesAid Software donaldb@281.com "jake lamotta" <jake.lamotta.xghfz@excelforum-nospam.com> wrote in...