SetFocus is ignored

I have textboxes in the Form Header of the Main Form ; and have a SubForm in 
the Detail Section.

On the last box in the header area I put in the OnExit event:

Me.SubForm.Form!ABCtextbox.SetFocus

....and it is ignored...no error or anything...the tab returns to the first 
box in the Form Header....

If I put my cursor in the subForm's ABCtextbox, everything is fine and it 
does not have the tab stop turned off or anything...

Any suggestions?

-- 
NTC
0
Utf
10/11/2007 2:15:00 AM
access.forms 6864 articles. 2 followers. Follow

3 Replies
1073 Views

Similar Articles

[PageSpeed] 21

Is there anything else happening at the time?
For example, moving record, loading the form, applying a filter/sort, or 
saving the record?

Is this last control bound to a field?

Does this only occur when there are no records?

It should work. You could try the LostFocus event.

-- 
Allen Browne - Microsoft MVP.  Perth, Western Australia
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"NetworkTrade" <NetworkTrade@discussions.microsoft.com> wrote in message
news:2B43B0A3-16A6-49A6-A4E7-1114AFF990C7@microsoft.com...
>I have textboxes in the Form Header of the Main Form ; and have a SubForm 
>in
> the Detail Section.
>
> On the last box in the header area I put in the OnExit event:
>
> Me.SubForm.Form!ABCtextbox.SetFocus
>
> ...and it is ignored...no error or anything...the tab returns to the first
> box in the Form Header....
>
> If I put my cursor in the subForm's ABCtextbox, everything is fine and it
> does not have the tab stop turned off or anything...
>
> Any suggestions?
>
> -- 
> NTC 

0
Allen
10/11/2007 2:57:52 AM
To set focus to a control in a subform when you're in the main form, you 
must first set focus to the subform control, then set focus to the control 
in the subform:

Me.SubForm.SetFocus
Me.SubForm.Form!ABCtextbox.SetFocus

-- 

        Ken Snell
<MS ACCESS MVP>




"NetworkTrade" <NetworkTrade@discussions.microsoft.com> wrote in message 
news:2B43B0A3-16A6-49A6-A4E7-1114AFF990C7@microsoft.com...
>I have textboxes in the Form Header of the Main Form ; and have a SubForm 
>in
> the Detail Section.
>
> On the last box in the header area I put in the OnExit event:
>
> Me.SubForm.Form!ABCtextbox.SetFocus
>
> ...and it is ignored...no error or anything...the tab returns to the first
> box in the Form Header....
>
> If I put my cursor in the subForm's ABCtextbox, everything is fine and it
> does not have the tab stop turned off or anything...
>
> Any suggestions?
>
> -- 
> NTC 


0
Ken
10/11/2007 3:02:12 AM
If I'm not mistaken, I believe you have set focus to the subform itself 
first, then to the control within the subform like;

Me!SubForm.SetFocus
Me!SubForm.Form!ABCtextbox.SetFocus

BTW - is "SubForm" the actual name of your subform?

HTH

-- 
_____________________

Sean Bailey (regular guy)


"NetworkTrade" wrote:

> I have textboxes in the Form Header of the Main Form ; and have a SubForm in 
> the Detail Section.
> 
> On the last box in the header area I put in the OnExit event:
> 
> Me.SubForm.Form!ABCtextbox.SetFocus
> 
> ...and it is ignored...no error or anything...the tab returns to the first 
> box in the Form Header....
> 
> If I put my cursor in the subForm's ABCtextbox, everything is fine and it 
> does not have the tab stop turned off or anything...
> 
> Any suggestions?
> 
> -- 
> NTC
0
Utf
10/11/2007 3:06:01 AM
Reply:

Similar Artilces:

Junk Mail Filter Ignores Setting to Ignore Contact List Members
I find that the Outlook 2003 Junk Mail filter ignores my Safe Sender list in some cases. I have several lists and users that I get mail I want from but most mail from them go straight into the junk e-mail folder instead of being ignored by outlook as they should. Same applies to some people on my contact list, i've set the junk mail filter to ignore email from people on my contact list but it doesn't help. It appears that certain words and/or short messages triggers the junk mail filter but then it bypasses the "ignore people on my contact list" and "safe send...

SetFocus() ?.....
Hi there. I have a simple dialog-based application. In one dialog's OnInitDialog function, I try to set the focus on a particular Edit box using: CEdit *pEdit = (CEdit*)GetDlgItem (IDC_MY_EDIT); pEdit->SetFocus() however, this seems to have no efect - focus goes instead to another edit (the first in my tab order) Any ideas what I'm missing? Any help would be appreciated!.... "len" <len@discussions.microsoft.com> wrote in message news:3112BEC2-1F8B-4BCD-A056-0A54B05F167C@microsoft.com... > Hi there. > > I have a simple dialog-based application....

Setfocus question
Hi, I have 5 textboxes on a multipage control. In 4 of the textboxes, the user should enter his details only once, while in the fifth textbox the user should reply a question and click the OK button. No matter what was his answer, he gets new question and the focus shouls be back to the fifth textbox in order to reply the next question. My problem is that I want that the user will be able to send his answers not only by clicking the OK button but also by clicking 'Enter' after typing the answer to the textbox, and I can't get the focus in the fifth textbox after ...

Decimal key on keypad is ignored
In Excel 2000 with fixed decimal 2 places in the setup, I could enter 10+. and the cell would read 10.00. In 2003, the decimal is ignored and I must enter 1000 to get 10.00. Is there a way to fix this change? The functionality has not changed in Excel 2003, the fixed decimal is overridden if you manually enter the decimal. I would check a couple of things 1) Your decimal separator under windows regional settings is . 2) If you are wanting to use the system separators, as above, you make sure that setting is checked in Excel Tools>Options>International>Use system settings Of...

SetFocus problem.
My application has a hidden main display window that is never used. The application hangs out in the system tray and has a couple of configuration windows that can be opened from the system tray menu. The program has a couple of odd-ball fatal error scenarios. When these happen, the program displays a fatal error message using AfxMessageBox and it shuts down normal processing. This includes stopping the system menu so that the config windows can't be opened. Here's the problem: If the AfxMessageBox window is covered by some other program, I want the action of right clicking my...

SetFocus() and the cursor
Sorry for the novice question here. I have a CEditView in a MDI app. I want to do some things in OnSetFocus() for the view but when I override OnSetFocus() I lose the (carat) in the CEditView. I I suppose I am supposed to turn the carat (cursor?) back on when the focus is set to that view but I am having trouble getting that to work. I can create another carat but it doesn't seem connected to the Edit View since it does not move with keystrokes. How to I resume the default carat or setup a carat that works the same way in my OnSetFocus() routine. Thanks eng What is it that you are d...

Why does Publisher ignore number of copies and print only one?
When I try to print multiple copies to my HP Color Laser 5550dn, I only get one copy regardless of how many copies I enter into the print dialog box. Have you checked to see if there are updated drivers available? -- JoAnn Paules MVP Microsoft [Publisher] "Timothy R. Bolick" <Timothy R. Bolick@discussions.microsoft.com> wrote in message news:EA90DB5E-753E-441E-B9A6-7CB4CAAFFFD6@microsoft.com... > When I try to print multiple copies to my HP Color Laser 5550dn, I only > get > one copy regardless of how many copies I enter into the print dialog box. Accordi...

.SetFocus() to an IFrame
Hi everyone, I have a Tab with an IFrame to a WSS doc lib. Since the name of the Account is integrated with SharePoint, I have OnSave code that check to see if the Account Name has been changed. If it has, the user is alerted, and I want the Tab with the doc library to take focus. How can I use .SetFocus() on a tab? I've tried: crmForm.all.tab2Tab.SetFocus(); crmForm.all.iframe_name.SetFocus(); Neither work. So I added a field to the IFrame tab, tried to SetFocus() to that field, then hide it: crmForm.all.my_field.SetFocus(); crmForm.all.my_field.style.display = 'none'; ....

Setfocus and the Caret
I have a CEditView and I am attempting to use the OnSetFocus() call for some things. But I lose my caret in the editor when I do this. I tried creating another caret and Show() ing it but I can not recover the caret or get it to show. Am I correct in assuming that I would be working with the Caret in the embedded CEdit control? So something like GetEditControl()->ShowCaret()? Thanks eng What are you doing in OnSetFocus that cause the caret to disappear? AliR. "Jona Vark" <noemail@all.com> wrote in message news:gX6Ie.1029$C11.439@newssvr21.news.prodigy.com... > I ...

Ignore Symbols in a cell
In cell I4 I have the value (# 6) and in cell I10 I have just a number ...say 60. I would like to divide cell I10 by Cell I4. I get a value error. -- Geo =I10/SUBSTITUTE(I4,"# ","") HTH Jason Atlanta, GA >-----Original Message----- >In cell I4 I have the value (# 6) and in cell I10 I have just a number ...say >60. I would like to divide cell I10 by Cell I4. I get a value error. >-- >Geo >. > try =SUBSTITUTE(i4,"#","")+2 -- Don Guillett SalesAid Software donaldb@281.com "Geo" <Geo@discussions.microsoft.com&g...

Error:Object expected , Function:setFocus()
Hi, I am getting a pop up msg. box while saving an activity or incident with values in any lookup fields(ex: From, To ,Regarding frields in Activity). This start happening after UR7 upgrade. when I keep all lookup fields empty and save it's successfull. Please let me know if anybody faced the similar error and got resolved. Error details I am seeing when clicking on 'View the date that will be sent to Microsoft' is, Microsoft Dynamics CRM Error Report Contents <CrmScriptErrorReport> <ReportVersion>1.0</ReportVersion> <ScriptErrorDetails> <Mess...

CWnd::SetFocus()
Hi, CWnd::SetFocus() is used to direct all subsequent keyboard input to this window. Do you know which function is used to direct all subsequent "mouse input" to the window? I have a combo box and an active control. My combo box always gets the "mouse" focus even I apply CWnd::SetFocus() to my active control. Do you know how to achieve this purpose? Your help is much appeciated. JD Take a look at this article http://www.codeproject.com/dialog/dlgboxtricks.asp -- -Sarath "JD" wrote: > Hi, > > CWnd::SetFocus() is used to direct all sub...

setFocus & inner join query glitch...
I have the following query which works excellently to populate my form, using the criteria [txtFieldID] from my form. SELECT tblFieldIDsPRNUMsNumeric.FLD_ID, tblFieldIDsPRNUMsNumeric.PRNUM AS Project, tblFieldIDsPRNUMsNumeric.prnum_num, food_master.pesticide, food_master.commodity FROM food_master INNER JOIN tblFieldIDsPRNUMsNumeric ON food_master.prnum = tblFieldIDsPRNUMsNumeric.prnum_num WHERE (((tblFieldIDsPRNUMsNumeric.FLD_ID)=[forms]![frmFieldIDinput]! [txtFieldID])); Then I added a new table and related field [tblStudyDirecto.sd] and now I get an error when I load the for...

CTabCtrl Ignoring Resource Template?
I've got a CDialog-derived class that loads from a dialog template. The template specifies a tab control, with certain bounds. I have my own CTabCtrl-derived class to handle the tab control. When I create the dialog, however, the tab control that gets created has the wrong bounds; it seems to be ignoring the resource template completely. Moreover, if I override the Create() and CreateEx() methods of the CTabCtrl, they never get called. Everything else seems to work; I can resize the control and it works fine; it's just that it doesn't seem to pay attention to the resource t...

trap setfocus message in custom CWnd control
I create a custom control derived from CWnd and I would like to change it base on focus status through OnPaint(). I already add OnSetFocus(), OnKillFocus() in order to change some flags and then Invalidate(). the problem is that when the contrl get focus and lost it never go to OnSetFocus() Do I need to do something more than just add focus' message (by classWizard)to make it happen. Thanks in advance for your help, Eduardo ...

ignore first 2 characters
Is there anyway to format a cell so that it trims off the first 2 characters of the cell. For example my cell contains a query that shows PR101 or PL101. Is there a way to make it just show 101. For this application the PL and PR don't matter. Am I out of luck on this one or can it be done. Thanks. got to make a new column (if your #'s are in A, here's the function in B) = Right(A1,Len(a1)-2) HTH *** you aren't related to Jason Sneed (in charlotte)are you? "Sneed924" wrote: > Is there anyway to format a cell so that it trims off the first 2 characters &...

Subform + Setfocus
I have a main form, which contains mulitple subforms. I have the end users clicking on a command button to proceed to the next section(subform). I need the focus to be set to the firt text box in the subform. I seem to have the code right or so I think but it seems to keep the focus on the first subform instead of proceeding the next subform and setting the focus on the first text box. The code..... Private Sub gotoSecB_Click() Dim Response As Integer, shellexecute As Control Dim rtn rtn = CheckFormR(Me) If Not IsNull(rtn) Then MsgBox rtn Exit Sub End If If MsgBox("Is there a...

Pivot Table to Ignore N/As
Hi, Does anyone know if it is possible to get a pivot table summary to ignore N/As within a table when summing the data? Nelson I don't. Maybe you could clean them up in the original data (if those cells are a formula): =if(iserror(yourformula),0,yourformula) Or even use another column: =if(iserror(b2),0,b2) Then use that other column in the pivottable. Nelson wrote: > > Hi, Does anyone know if it is possible to get a pivot table summary to > ignore N/As within a table when summing the data? > > Nelson -- Dave Peterson Thanks Dave, that's what we figure...

Ignoring reminders with the X in the corner
I opened Outlook on a second machine so I coul track incoming email. Some reminders popped up which I wanted to reset to come back in two hours but figured I'd do them on the first machine, so I closed them with the X in the corner, figuring they'd still be there on the other PC. They weren't. And I wasn't paying attention to what they were; I was too busy... I closed Outlook on both machines, then reopened on one - the reminders didn't come back for the several I thought I was just ignoring by closing them. I know if I close Outlook when there are reminders open, they...

SetFocus Not working
Hello. I have a userform with a textbox and a commandbutton that are not working as expected with regard to setfocus. After commandbutton3 is clicked, I want to set the focus to textbox3. This works just fine. However, I have a keydown event in textbox3 that runs commandbutton3_click sub if the enter key is pressed. When this event runs, everything works except textbox3.setfocus. Any help is appreciated. Private Sub CommandButton3_Click() If TextBox3.Value <> Empty Then ListBox1.AddItem TextBox3.Value TextBox3.Value = Empty TextBox3.SetFocus End If En...

Problem with SetFocus
I am trying to set the focus of a form when some enters a duplicate value. The logic is correct, but the focus goes to the next field. All I want to do is blank the field and toggle back to that same field. The form is a datasheet view of another table. I would like duplicates to be allowed, but the end user is prevented from entering them. I am lost as to why this isn't working. Code below: Function checkTag() As Integer Dim db12 As Database Set db12 = CurrentDb Dim rs12 As Recordset Set rs12 = db12.OpenRecordset(Me.Name, dbOpenDynaset) rs12.MoveFirst rs12.FindFirst "[ServiceTa...

Xml Serialization
I would like to serialize a particular class into XML skipping the root element that is automatically created for the class. For example if I have the following class: public class Person { [XmlElement("name")] public string Name; [XmlElement("age")] public string Age; } I would like the following result: <name>someName</name> <age>100</age> Without the element "<Person>" that would usually be created. The reason for this is I have a class that represent several Xml elements, and when I serialize that class I...

setfocus not working?
I have VBA code which is run in the AfterUpdate event for a text box. It basically checks to see if the data entered in the text box matches a criteria. If not, it displays an message box asking if they want to continue. If not, I want the text box to be re-selected so that they can change the value. The following is my VBA, which uses SetFocus to re-select the text box. But for some reason, if I try to SetFocus back on the text box, it is completely ignored and the form moves on to the next field. However, if I SetFocus on a different control it will do it just fine. So, I tried...

SetFocus to a control on a subform
Hi I can use your help in getting the cursor back to a control on a continuous Subform. The sub has two controls, Inv# and Amount. I use the AfterUpdate on the Amount control to test whether the payment amount equals the invoice amount. If the two are not the same, I prompt the user and would like to return the cursor to the Amount control on the last line in this multi-line subform. Thanks Here's the syntax you need in the 2 step process: Me.SubFormControl.SetFocus '-- Set Focus to the SubFormControl 1st Me.SubFormControl.Form!ControlName.SetFocus &#...

Ignore #REF! when adding columns?
I have a spreadsheet that updates links from other sheets daily. At th bottom it tallies the monthly runing totals.Since some of the sourc sheets do not have data yet entered, I get a #REF! in my cells tha have no data, therefore my monthly accumalated also has #REF!. How can I get it to ignore the #REF! and/or show these as blank? Thanks-Gre -- singlgl ----------------------------------------------------------------------- singlgl1's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2638 View this thread: http://www.excelforum.com/showthread.php?threadid=48013 O...