Forms :: Set Focus To Sub Form?
Sep 14, 2014
On a main form I have 2 sub forms. On the main form I have a command button that asks how many guests in a booking and depending on the response populates the subform with Guest Names. However it will only do this if I click on the subform and then click the command button.
I want to include some code that sits behind the command button on the main form that will duplicate the otherwise manual selecting of the sub form. And I am thinking this is a SetFocus procedure.
I have tried this code;
[Forms]![Booking].[SubForm1].SetFocus
where Booking is the name of the form. I do not know whether the Subform is #1
View Replies
ADVERTISEMENT
Jun 24, 2013
When I right click a row on the data sheet side of a split form an select "New Record" I want the curser to go to the first field on the single record side. I've placed this in the OnCurrent but it did no good.
Code:
If Me.NewRecord Then
Me!Descrfiption.SetFocus.
End If
Any way to set the focus to the single form Side of a split form?
View 4 Replies
View Related
Dec 29, 2014
How do you set the focus on the first field in a modal form when it opens?
View 3 Replies
View Related
Jul 10, 2014
I have a Main Form with a tab control. On each of the six tabs is a SubForm that takes up the entire tab. So basically I have a tabbed interface for my forms, just with a bit more control over the layout than if I just opened the forms separately in the Access window.
Anyway, on one of those subforms is a button. When you click it, it opens a separate form in a pop-up window, which is used to find a specific record. Once that record is found, you can click another button, and the idea is that this pop-up window closes, and you return to the underlying form, which jumps to the record you selected.
So far so good. Now, if I am working on my program in Access, and I open that subform's source form separately in its own tab, click the icon to open the record finding form, find a record, and then click the button to load that record, the following code runs, and it runs flawlessly - closing the pop-up window, and passing the information back to the main form which displays the proper record:
Quote:
Private Sub ViewRecord_Click()
Dim RecordID As Integer
RecordID = Me.ID
DoCmd.OpenForm "CDLExam", , , "ID = " & RecordID
DoCmd.Close acForm, "CDLExamCONT", acSaveNo
End Sub
Where my program falls apart is that, in actual use, this form is not open on its own. It's open as a subform on one tab of a tab control on a Main Form. So the third line of code falls apart. Access thinks I want to open CDLExam separately, but it can't because it's already open in the subform, so instead I just end up back at the main window like I want, but the form fails to move to the proper record. Basically, line 3 just doesn't do anything.
How can I make this work? I tried replacing "CDLExam" with the name of the main window, but then it tries to move to the record in the main window, which throws an error as the main window doesn't even have a record source attached to it.
how to refer to the SUBFORM which has CDLExam open, and tell THAT to move to the proper record.
View 14 Replies
View Related
Jan 28, 2015
How can I make a button in a pop-up form to send enter key to a text box in another form? Do I need to set focus to the other form first? And how?
View 1 Replies
View Related
Sep 10, 2014
On my data entry form I have a tab control with three pages
At the bottom of the first page I have a sub form with 3 fields
Currently, when tabbing, the focus runs through the fields as per the tab order
BUT
Once it gets to the subform (datasheet view) it jumps into the first field of the first record rather than the first 'empty cell' thereby starting a new record in the datasheet.
Once the three fields in the datasheet are completed the focus tabs back to the top of the first page of the form rather than onto the next page of the form
How to correctly reference controls using VBA so I could SetFocus where I want?
The Main form is called frm_Admissions
It has three pages called Patient, Treatment & Service Providers
Patient has a subform called sub_Cluster (which may or may not hold Cluster Information)
I would like the tab order to jump from the last textbox on the form into the first field of a new record in the datasheet (rather than the first field of any existing records)
Once it has finished in the datasheet I need to tab to the first field/textbox in the Treatment's page of the form rather than back to the first field/textbox in the Patient's page.
View 3 Replies
View Related
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
Oct 27, 2014
I have unbound TextBox in continuous form and I would like that it never get focus. In property I specified Enabled=No and Locked=Yes. But it doesn't work.
View 8 Replies
View Related
Jul 22, 2013
I have two forms that have a unique field (SSN).As I'm working in one form, I want to be able to pull up the other form (which isn't a problem). On the second form pulled up, I want the record to match the first form (SSN) - this is the problem.
I believe SetFocus is what I need to use but I don't know how to capture the SSN from the first form to use as the focus for the second form.
View 4 Replies
View Related
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
Aug 1, 2015
i have a button that allows you to "edit" the show that is selected. You can double click the show name from the list box, and it opens that show in viewing mode, but you cant edit it. You can click the edit show button in the form that you view the show with, but I want to be able to edit that show from the main form with the list box. But, the problem im having, is if someone clicks the "Edit show" button without have a show selected, they get a error.
If lstShows has focus Then
DoCmd.OpenForm "frmEventsEdit", , , "EventID = " & Me.lstShows
Else
'do nothing, since having no code here, it does nothing
End If
End Sub
That is what I want, but I cant get access to open that show up if its selected.I need to be able to tell if it has focus on it, and to open that selected show up.
View 4 Replies
View Related
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
Sep 1, 2013
This code stopped working without explanation after the longest time. I can't seem to fix it.
Code:
Private Sub Send_Letter_AfterUpdate()
Call Set_CallDateUserId
End Sub
Private Sub Set_CallDateUserId()
Me.txtCallDate.SetFocus
[Code] .....
View 4 Replies
View Related
Jun 22, 2015
I have a customer provide his or her SSN. If the SSN matches a record in a table the form opens specifically on that record (no problem). If the SSN doesn't match a record, the form adds a new record (again, no problem).
The issue I'm having is with the new record. The customer is able to scroll through other records (page up, page down), which is a no-no. I need the form to be locked on the new record. I've posted my code below.
Private Sub Command543_Click()
On Error GoTo Err_Command543_Click
Dim strCriteria As String
Dim rst As DAO.Recordset
Set rst = Me.RecordsetClone
[Code] .....
View 5 Replies
View Related
Feb 16, 2006
I have a parent form called "frm_job_enter"
and two sub-forms called "frm_fabricator" & "frm_engineer"
On the sub form "frm_fabricator" I have a combo box and after updating this combo box (called fabricator) I would like the cursor to jump into a field called “ApllicationsEng” on the other sub form "frm_engineer"
Any help would be appreciated thank you.
View 3 Replies
View Related
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
Nov 11, 2013
I have a continuous form with a combobox and a text box. In the after_update event of the combobox I want to setfocus on the text box - of the specific record that I'm on. I tried using Me.CurrentRecord but that returns me to a completely different record than the one I was on. How can I setfocus to the text box of the record I am on?
View 12 Replies
View Related
Jun 23, 2013
I have a subform that I use to scan in products using a barcode reader, when the item scans it moves to the quantity (Qty) field where I have this code:
Code:
Private Sub Qty_GotFocus()
Qty.Value = 1
DoCmd.GoToRecord , , acNewRec
txtOrderNo.SetFocus
End Sub
I am simply trying to set the Qty value to 1 and move onto the next record ready to scan another product in.
View 10 Replies
View Related
Mar 17, 2013
I have a Dynamic Search form, which I use to search for client, on the double click it takes me to the client, at which point I have the Forms Visible set to False.
When I click on a button to open that Form, the Visible turns back to True, however it shows my last search results, how do I clear it so that when I call it back up it is ready to search again, and my focus is set to the SearchFor box.
View 3 Replies
View Related
Dec 8, 2014
In a form, I go to a textbox with setfocus. The whole text is selected then. But how can I place the cursor after the existing text, so that I can begin writing immediately?
View 3 Replies
View Related
Sep 1, 2013
When the client clicks in a text-Box or Combo-box in a sub-form, the field seems to jump to the side. in this image it jumps to the left, but jumps to the right to..., it is quite irritating, especially attempting to open a combo-box list, and see the button jumping aside.We renewed the file many times, so I don't think it is corrupted, but go know..the file can be accessed via network or terminal server, the pic is from terminal, but happens via network too.
View 1 Replies
View Related
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
Jun 26, 2015
I am having trouble setting the focus on my forms... I have a parent form with two labels that are coded like this.
Private Sub Advisory Messages_Click()
Me![ Advisory Messages].Visible = _
Not Me![Advisory Messages].Visible
End Sub
[code]...
I have the visible property set to no on the subform allowing the user to toggle the visibility when the label is clicked. The problem though is when I click inside the subform to use the scroll bar to view records, it transfers the focus to the subform making it almost impossible to close by clicking the label again because the label is on the parent form. I found the "me.parent.setfocus" command and a few other set focus commands but I don't know what I should be applying the command to in order to make it work.
View 3 Replies
View Related
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
Jul 18, 2015
I have a form that allows me to update entries in a table. When I select the line I need to update and hit the "edit" button I get a run time error '2164' You cant disable a control while it has the focus. when I debug the line in the code that is highlighted yellow is
Me.cmdEdit.Enabled = False.
I developed the database in access 2013, and now I am forced to run the database on a computer that has Access 2003. I have changed the database base to access 2000-2003.
View 5 Replies
View Related
Jan 18, 2015
I have a toggle control on a form which depending on selection uses a loop and instr to make 'not visible' a set of controls on a subform.(forms! Mainform !subform.form)I get error 2165 but if I test immediatley before the make not visible process it returns the toggle frame as being the active control.
View 3 Replies
View Related