Set Focus To A Sub-sub-subform

Jan 2, 2007

I have 4 nested forms:
DataEntryMaster
DataEntryMainSub (subform on DataEntryMaster)
DataEntrySub2 (subform on DataEntryMainSub)
DataEntrySub3(subform on DataEntrySub2)

In the AfterUpdate even of DataEntrySub2, I have code that checks to make sure the field on DataEntrySub3 (it has only one field) has been filled in. If not, I want to set the focus to DataEntrySub3.

The code in the DataEntrySub2 afterupdate event:
if isnull(me!dataentrysub3.productbarcode then
msgbox "You must enter a product barcode!"
forms!dataentrymaster!dataentrymainsubform!setfocu s
forms!dataentrymaster!dataentrymainsubform!dataent rysub2.setfocus
forms!dataentrymaster!dataentrymainsubform!dataent rysub2!dataentrysub3.setfocus
end if

I've used this most-wordy syntax because I couldn't get the shorter syntax (eg, me.dataentrysub3.setfocus) to work at all. However, this STILL doesn't work.

What's really puzzling is that if I run those exact same 3 setfocus statements from the immediate pane, they work fine. But in the afterupdate event, my focus always ends up on a control in dataentrysub2.

Any ideas???

View Replies


ADVERTISEMENT

Subform Won't Surrender Focus

Mar 9, 2005

Well, the title says it all really. After I click into the subform and type something in a text box, the focus will not return to the parent form, via mouse or tab. I can't even switch the form back into design view, it appears to be totally locked. Has anyone run into this before?

View 4 Replies View Related

Set Focus To Subform But Do Not Activate

Sep 28, 2006

i won't go into details except i am doing databases for cemeteries - very complicated
example
i have come across two people who have the same name, date of death, buried in the same grave on the same day but are not related and must have seperate records!!
my main table has 6 primary keys. [even then i have 2 duplicates who are not related]
anyway one of the problems is this
i have a main form with 2 subforms. the main form is unbounded. i need to copy information from 1 of 4 queries run by the main form [QBF] to one of the subforms. i don't know which query untill i view the data.
when i know which one, i press a command button which copies the information to one of the subforms. when i repeat the actions above instead on the new query data going into a new record on the subform it overwrites the existing data instead of pasting it into a new record.
i have tried setfocus command - this works only if i click on the subform and activate it [this defeats the object of the command as i might just as well click in a new record box on the subform].
in essence i do not need to activate this subform at all. i just need to check if a record exists and if it does goto a new record [again this works only if i physically click on the form]
any ideas how i can force the cursor to goto a new record without physically clicking on the subform??

thanks

View 6 Replies View Related

Forms :: Set Focus To A Subform

Mar 20, 2014

If i open a form with a sub form on can i open it so that the focus go directly to a control on a sub form.I have tried to do it with a macro on the on open event to go to control but it comes up that the control don't exists on the sub form.i am using access 2010.

View 6 Replies View Related

Validation Before Focus Enters Subform

Aug 25, 2004

When I click on my subform after entering some data in the primary form, I get this error message:

"The Microsoft Jet database engine can't find a record in the table <name> with key matching field(s) <name>. (Error 3101)"

This is because I have not filled in a ItemCode, a combobox, on the parent form and ItemCode is part of a one-to-many relationship that involves automatic filling in of other fields such as ItemDesc, UnitPrice, etc. How do I code the validation that handles such an error?

Thanks in advance,
Swee

View 4 Replies View Related

Forms :: Set Focus On Subform Control?

Mar 7, 2014

I have a form with a subform on it. The subform has subforms. I need to set the focus on a control on one of the subforms. Here is what I am using.

START OF CODE
Forms!frmMain!frmMainSub.Form.frmContactLog.SetFoc us
Forms!frmMain!frmMainSub.Form.frmContactLog.Contac tMethod.SetFocus
END OF CODE

I use Code 1 to get to the third level. Code 1 works.

Code 1
Forms!frmMain!frmMainSub.Form.frmContactLog.SetFoc us

When I add the second line, Code 2, it doesn't work. I get the message "Run-time error 438: Object doesn't support this property or method."

Code 2
Forms!frmMain!frmMainSub.Form.frmContactLog.Contac tMethod.SetFocus

View 2 Replies View Related

Forms :: Set Focus To Last Line Of Subform

Jan 21, 2015

I have a single main form with a datasheet subform. When I scroll through the records shon in the main form, each has a different set of child records shown in the subform.

I want the focus to be on the last record of the subform each time.

On the main form, I have a button and this code

Code:
Private Sub cmdLast_Click()
Me.frmRevisionsSub.Requery
Me.frmRevisionsSub.SetFocus
Me.frmRevisionsSub.Form.txtRevTag.SetFocus
DoCmd.GoToRecord , , acLast
End Sub

which works perfectly, when I click the button.

If I call this code from main form's OnCurrent, focus remains on the first line of the subform instead of going to the the last. I have an inkling that it has to do with when the requery of the subform takes place, when I scroll through the records on the main form.

View 1 Replies View Related

Forms :: Subform - Set Focus To Other Record

Jan 2, 2014

I have a form with a subform which is sized to show several records at the same time. If Record A has the focus, and I click anywhere in Record B, then Record B gets the focus, as expected. ... Except if I click on an Image field in Record B, when the focus stays on Record A.

How I can force it to set the focus to the other record ? I don't think this can be done with Events handlers, as they need to have the focus set first.

View 5 Replies View Related

Multiple Picture Change Subform Focus

Apr 22, 2015

Is it possible for an image control to change to a different picture on a form when focus changes to a different record on a subform? I am developing a simple database to record my ever growing collection of TV shows. The form that I use to view my TV show records has an image control on it, I previously had a single image for the entire series (box art for first season). I now want that image control to change to a different picture when the focus changes to a different record on the subform. i.e. when the focus changes from the first season on the subform to the second season; the picture on the main form changes with it.

View 7 Replies View Related

Forms :: How To Lose Focus From A Subform When Selecting Record

Dec 17, 2014

I have a form, with a subform,

When a user selects a record from the subform i use this to view the record in the main form

Private Sub Txt_Support_Name_Click()
DoCmd.ApplyFilter , "ID =" & Me.ID
End Sub

However when i select the record from the subform, it populates the form as required, however then the top record of the subform is highlighted.

Any way to either - highlight nothing, or highlight the selected row?

View 4 Replies View Related

Forms :: Subform Takes Focus From Top Of Main Form?

Jun 29, 2014

I have a form that I created that has a tab control. When the form loads, it automatically sets the focus to a field in the subform. This wouldn't be a problem, except when it does it hides the tabs at the top of the form so I have to go and scroll back up every time I click a tab so that I can see the tabs. Is there a way to adjust this? I have tried hiding a field and setting the focus to it and that didn't work. I also tried setting the focus to the actual tab, but that also did not work.

View 8 Replies View Related

General :: Highlight Subform Textbox Border Color On Focus

Nov 19, 2014

I am trying to highligh a subform textbox a yellow color on focus. However it is highlighting every textbox in that field as it is a continuous form therefore they are all named ThisCount.

Is there a way to highlight just the specific textbox that I am in. I have tried.

Code:
Me.ThisCount.BorderColor =RGB(255, 215, 0) 'gold
Me.ThisCount.BorderWidth =3

and tried

Code:
Dim ctlCurrentControl As Control
Dim strControlName As String
Set ctlCurrentControl = Screen.ActiveControl
strControlName = ctlCurrentControl.Name
Set ctlCurrentControl = Screen.ActiveControl

ctlCurrentControl.BorderColor = RGB(255, 215, 0) 'gold
ctlCurrentControl.BorderWidth = 3

View 8 Replies View Related

Forms :: Move Focus From Last Field Of Subform To Another Field On Main Form

Aug 19, 2015

I am currently stuck on set focus property. I have a main from with nested subform. I am trying to move the focus from last field of the subform to another field on the main form.

Customers(mfrm)....>Addresses(sfrm)...>Orders(sfrm Add)......>OrdDetails(sfrmOrders)

Now I have a field name [Securedesign] in frmOrderdetails and I want the tab order to navigate to field [CustomerID] in frmAddresses which is a subform to frmCustomers.

View 2 Replies View Related

How "hide" A Subform That Is In Focus

May 6, 2005

I have a mainform (f1) and a subform (f2). The subform normally is not visible ([Fomrs]![f1]![f2].visible = Fasle). When I click on a command button on the main form, the subform wiill show up on the main form ([Fomrs]![f1]![f2].visible = True). There is another command button on the subform. When I click on the button, it opens up a third form (f3). The relationship between f1 and f2 is master-child, and the relationship between f2 and f3 is also master-child.

After I open the third form, I want to close (hide) the subform (f2), but I got an error saying that I can not "hide an object that is in focus".

Do you know any trick to do that? Thanks a lot.

Zoo

View 1 Replies View Related

Set Focus Nothing?

Mar 24, 2005

I have several forms and subforms that display data, but are not used for data entry. The first textbox on every form gets the focus on open. I'm sure I've seen some way to open the form with no focus on any control!

Can someone help me remember?

Thanks,

Sup

View 3 Replies View Related

Get Focus

Apr 15, 2005

thanks for helping.

how do i get a record to get focus when a form opens or a button is clicked on?

thanks again

View 2 Replies View Related

Set Focus

Jan 9, 2006

I am having trouble getting the cursor to change focus after updating a field in my tab control subforms. I have a main form with a tab control and 4 related subforms for each record in the main form.

I have a calendar that pops up with the On Click of my Date field. When the date is selected, it enters it into the field and the calendar closes. For some reason though the user cannot simply go to the next record with the mouse and has to tab to or select another field in the same record first and then click on the Date field in the next record.

I have tried SetFocus to "Hours" (the next field after "Date")and "NextRecord" on every Event I can think of but it does nothing, it just stays on the changed field and the only way to get out of it is to go to another field. I've tried saving, requery, etc. I've also tried the options shown in the forum with no luck and using different events associated with the Calendar form - On Close, Lost Focus, etc.

Any suggestions? Thanks

View 6 Replies View Related

Which Tab Has Focus

Nov 9, 2006

I have a form that has 9 tab pages. I have an amend button in the form footer that will do a different thing depending on which tab has the focus. How can I find out which tab has got the focus when I click the Amend button?

View 2 Replies View Related

Could Not Set Focus

Nov 30, 2006

Hi

I have a problem with setting focus to a text box. There is a listview on the form. Double clicking on a row will search the database for that record using SNo field and then display the contents on the respective control. When I click on a row the first time, it works. Clicking on the second row immediately gives the error "error 2110 - Access cannot set focus to the control txtReference.
Here is the code.......
Private Sub lvwOrders_DblClick()
ClearAll
Set rs = New ADODB.Recordset



rs.Open "SELECT * FROM tblOrderEntry where sno=" & ListView.SelectedItem, con, adOpenKeyset, adLockPessimistic
lblFooter.Caption = "Edit Record"

subRetrieve

End Sub



Private Sub subRetrieve()
Form_OrderEntry.SetFocus
With rs
For i = 0 To lstCostCenter.ListCount - 1
If lstCostCenter.ItemData(i) = !CostCenter Then
lstCostCenter.Selected(i) = True
Exit For
End If
Next i

txtReference.SetFocus
txtReference.Text = !ReferenceNo

txtOrderNumber.SetFocus
txtOrderNumber.Text = !OrderNo

For i = 0 To lstCostCenter.ListCount - 1
If lstCostCenter.ItemData(i) = !CostCenter Then
lstCostCenter.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstDescription.ListCount - 1
If lstDescription.ItemData(i) = !Description Then
lstDescription.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstOrderStatus.ListCount - 1
If lstOrderStatus.ItemData(i) = !OrderStatus Then
lstOrderStatus.Selected(i) = True
Exit For
End If
Next i


For i = 0 To lstSalesRep.ListCount - 1
If lstSalesRep.ItemData(i) = !SalesRep Then
lstSalesRep.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstPaymentMethod.ListCount - 1
If lstPaymentMethod.ItemData(i) = !PaymentMethod Then
lstPaymentMethod.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstCallType.ListCount - 1
If lstCallType.ItemData(i) = !TypeofCall Then
lstCallType.Selected(i) = True
Exit For
End If
Next i

For i = 0 To lstStatus.ListCount - 1
If lstStatus.ItemData(i) = !Status Then
lstStatus.Selected(i) = True
Exit For
End If
Next i

If !Status = "Pending" Then
txtReasons.Visible = True
lstAssign_Reasons.Visible = False
txtReasons.SetFocus
txtReasons.Text = !Reason
ElseIf !Status = "Assign" Then
lstAssign_Reasons.Visible = True
cmdSave.SetFocus
txtReasons.Visible = False
For i = 0 To lstAssign_Reasons.ListCount - 1
If lstAssign_Reasons.ItemData(i) = !Reason Then
lstAssign_Reasons.Selected(i) = True
Exit For
End If
Next i
End If


End With
End Sub

What can be going wrong ?

View 3 Replies View Related

Setting Focus On Tab

Apr 11, 2008

Hi everyone,

how would i go about setting focus on a tab control? i have a tab control on a form with 6 tab pages. i am on page 4 ( bank ) and i have a button to add a bank account. this opens up the add form and i add the account. i then requery the form and the tab goes back to page 1. how do i set the focus back to the previous opened tab?

many thanks,


Nigel

View 2 Replies View Related

Set Focus On Form

Jan 28, 2005

I have a form, and when it opens it has focus on a box i dont want it to focus on

How do i change which box it has focus on when it is opened?

View 3 Replies View Related

Focus Problem

Feb 22, 2005

I have two buttons on a form, one of them adds default information to three boxes, the other clears the info. I want to be able to hide one o the buttons depending on what is in the box.

I know I need to change the focus away from the control in order to hide it, but how do I do it please?

I have this so far, but there is something missing!

Private Sub Command744_Click()
Me.BdeRec40kMarksmanship = Null
Me.BdeRec40kFireStatus = Null
Me.BdeRec40kOpening_Range = Null
Me.Command743.Visible = True
Me.command777.Visible = False

End Sub

View 2 Replies View Related

Subforms Focus

Mar 21, 2005

i have a main form, in which i have included 2 subforms on it. Now when i am at the last control on the main form, the focus moves to the first control of one of the subforms. However, when i am at the last control of this subform, on hitting the tab key, the focus does not move to the first control of the other subform.

How can i achieve this please?

Thank you!

View 1 Replies View Related

Focus Problem, I Think...

Apr 6, 2005

I have a form that allows a user to select from a variety of options and then generate a report. It consists of three option groups:

1) Select a Team: A B C

2) Select a Report: A B C

3) Input a Date Range: From (blank) to (blank)

If you progress down the list and finish entering the enddate and then click the mouse on the Run Report button, nothing happens. The cursor remains blinking in the enddate field. You have to manually re-select one of your previous options on the form to get rid of the flashing cursor and then re-click the Run Report button to generate the report.

The option to include the Run Report button in the tab order is not available, I don't know why, but it is an image if that makes a difference.

Any ideas? I'm thinking I have to set focus for something. I just don't know when or where.

Thanks for all replies!

View 1 Replies View Related

How Do I Set The Focus To The Next Record And.....

Apr 25, 2005

How do I delete this dummy record?

http://img.photobucket.com/albums/v401/Rrotz/phonelog1.gif

Also, how do I set the form to maximize fully like the above, when I open the form it defaults to this:

http://img.photobucket.com/albums/v401/Rrotz/phonelog.gif

View 2 Replies View Related

Get Focus On A Control

Apr 29, 2005

Hi

I would like a control to have focus when a form is opened or press a button - how do i do this?

Many Thanks

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved