General :: Setting Focus On Forms
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 Replies
ADVERTISEMENT
Oct 21, 2013
I have a form with a tab control on it. The input for respective fields are placed inside the tab control, and I have the "Confirm" button placed outside, on the main form. Now I wanted to be able to navigate my focus from a control from inside to tab control, out to the Confirm button on the form, to allow smooth flowing data entry.
However, it seems like Access separates the tab indexes for the controls in the tab control and outside on the main form, so setting tab index does not work. I tried using the code ON LOST FOCUS and SET FOCUS;
Private Sub txtPurchaseNote_LostFocus()
Forms![frm Imported]![cmdConfirmPurchase].SetFocus
End Sub
But then a dialog box appears:
Run-time error '2110'
Microsoft access can't move focus to the control cmdConfirmPurchase
(cmdConfirmPurchase is a button control)
View 2 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
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
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
May 30, 2006
i have a tabular form, which on its after update event, i requery the form, and it works fine. However, my only problem is that after the requery occurs, the focus moves to the first field of the first record. Is there a way in which after the requery, the focus will be set at the end, in that blank record, where to insert a new record ?
Thanks
View 14 Replies
View Related
Oct 12, 2006
What is the syntax for defining the tab that has focus when a tabbed form is opened under various situations?
View 2 Replies
View Related
Mar 1, 2014
it is possible to be able to scroll through a List Box with just a mouse over? Or, do you need to set focus on the ListBox before being able to scroll?
View 8 Replies
View Related
Jan 13, 2015
I am new to Access and to the forum. I made a check printing system
table name = 'burgan'
form name = 'burgan cheque'
Fields = 'PV' and 'cheque' and 'Beneficiary'
I have inserted a button (Command31).The function I would like to add on clicking the button
1. it should chose the highest value in both fields (PV and cheque)
2. Create new record
3. Increment it by 1 (both fields 'PV' and 'cheque')
4. the focus should stand on 'Beneficiary' field.
View 3 Replies
View Related
Sep 24, 2013
Windows vista
access 2007
I'm populating a report with a query which pulls criteria from a form. When the 'run' button is pressed it opens the report, running the query, to filter the data. What i'm attempting (and it works if there is data present).
The data is text, which is a filename, which populates an image control. Most of my records have an image present but for the ones that don't I think I need to turn the image control's picture property to 'blank'.
I'm just now encountering problems with the records with no pictures so when i came up with this it worked with my tests which at that time only had images present....
I have two problems.
1) When I run the code as below i get Run-Time Error 2185; you can't reference a property or method for a control unless the control has the focus.
2) when i try to set the focus on the picture control in the report to see if there is text/value present i get runtime error 2478; database doesn't allow you to use this method in the current view.
I assume this is talking about me opening the report in acViewPreview mode but i thought i needed to do this so the images are displayed in the image control.
Code:
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
Dim strDBPath As String
Dim strRelativePath As String
Dim strPath As String
'rptOriginalOwnerCategoryItem!Picture.Text.SetFocus
[B]Me!Picture.SetFocus[B]
'Test to see if the record has a relative path stored
[code]....
View 4 Replies
View Related
Mar 21, 2014
How to set focus to a non Default instance of a form.
Environment
A2007 ADP Project
Document Window Option - Tabbed Documents
MS SQL 2012 Express DB
Windows 7 64 Bit
I using Allen Browne's method to open more that one version of form, storing each form object in a collection declared in a module. No problem there.
Now I'm trying to add a command button on an form to set focus to one of these non-default instances already open.
The form I am trying to set focus to has a the following related properties
Default View: Split Form
Pop-up: No
Modal: No
The form that has the command button on it is of the same type.
Here is the code I've tried:
'Code on Calling Form
Private Sub cmdProjectList_Click()
Dim FunctionResult As Boolean
If AppForms.GoToForm("ProjectList") = False Then
AppForms.Load_ProjectList
[Code] .....
The code compiles and executes with seemingly no problems. It finds the form loaded, then cycles though and finds the form in Forms but the SetFocus call seems to do nothing. When I run the code against a defualt instance ( one not opened using Allen Browne's method) it works fine and sets focus to it as expected.
View 11 Replies
View Related
Oct 5, 2014
I've got the forms and queries in one .accdb file and my tables in a separate .accdb file. The forms file links to the tables in the tables file. The tables file resides in a folder called simply enough C:acc_tables and thats where i browsed to (obviously) when i set up the linkage.
One of the users does not wish (for whatever goddamn reason) to create a C:acc_tables file to stick the tables file in , and wants the tables file in some other folder.. Unfortunately this user does not have the skills to delete the existing links and re-link to the tables file after putting it in the folder he wants.
Where in the file that holds the forms and and queries do i find the path setting to the tables linked file? Can it be changed without deleting links and then re-linking?
View 4 Replies
View Related
Sep 21, 2012
I am trying to get the value of a combobox after selecting an "OK" button but get "You can't reference a property or method for a control unless the control has the focus." Most would probably say use .Value but when I press "OK" I am prompted for a value, or as in another case get Null.I tried setting the focus prior to the violating line of code, but no go.
Example:
Code:
Private Sub viewByRegionOKButton_Click()
DoCmd.OpenReport "byRegionReport", acViewPreview, , "RegionName = '" & regionComboBox.Text & "'"
End Sub
View 4 Replies
View Related
Mar 1, 2014
Right I have Windows 7 Ultimate because I am learning Russian and I have created an English Russian dictionary.
Now using Ultimate to go between English Latin alphabet and the Cyrillic alphabet you have to press ALT + SHIFT.
Its awkward and it often doesn't register first time.
Certain fields in my database use the latin alphabet while other fields use the cyrillic alphabet.
Is there a way that on focus of a field I can get the keyboard mapping to ensure that it is correct either English or Cyrillics?
View 5 Replies
View Related
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
Aug 19, 2014
I'm trying to set a filter with a command button. I've tried to do it like the examples I've read on numerous sites, but I can't seem to get the filter set. The code that seems most like the examples to me is:
Me.Filter = "[chkPaid] = 0"
Me.FilterOn = True
When I run this I get a box telling me to enter a parameter value for chkPaid. chkPaid is definitely the correct name for the checkbox control on the form. I've tried many variations with and without the square brackets, but as long as I have [chkPaid] inside of quotes I get the Enter Parameter box. If I leave the quotes off I get no parameter value request, but it doesn't set the filter either.
View 3 Replies
View Related
Mar 12, 2013
I am adding another portion to my database and since this is a little different than the other parts I created, I wanted to get some input from the experts.
I am adding Certifications to my database. I am currently tracking skills, OSHA, & Licenses for all employees. My current count for the Certification is around 45. I'm wondering if I should set this up like I did my Skills (look up table for skills that is connected by a one to many relationship to another table) or have all the info on one table?
View 9 Replies
View Related
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 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
Jan 17, 2014
Where in the options of Access 2010 do you set the option that requires holding down the shift key when open Access to see the files?
View 2 Replies
View Related
Aug 12, 2015
I have appx 500 customers that have contracts..... The contracts have 15 products that are available. Not all of the customers purchased all of items on the contract. I want to have a database that lists (on one page) the client information, contract information and the product details for that customer. I have no clue how to go about doing this. The Contact database template is what I am starting with. I want to click on a customer and pull up the information all on one page.
View 1 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