Forms :: Wrong Focus When Switching Among Pages Of TAB Control

May 3, 2013

I have a form with a TAB control and four pages. Each control of each page has his TAB index set correctly (starting from 0 to n), some of controls are not enabled to be tabbed. The form's cycle is set on "Current page".

I have two kind of problems.

First: I am on the last control of the page, pressing TAB key the focus gets invisible. Press TAB key again and the focus moves on the first page's control. For each page happens this behaviour.

Second: clicking randomly on the TAB pages the focus is not always on the control with TAB index 0, but usually on the last.

I have read that clicking on a new page the focus should be automatically on the first control, but this does not happen in my experience.

View Replies


ADVERTISEMENT

Toggle Button, Focus, Switching Back And Forth

Feb 6, 2006

Here's a little design problem, all of my VB script works fine, it's just a design problem:

Toggle Button (onClick) {
if pressed in, unlock protected field, pass focus to protected field
else (if not pressed in), lock protected field
}

Protected Field (lostFocus){
When Focus is lost, protect field then reset toggle button
}
See, there's no way that I know of for Access to tell what field has focus at any given moment. It lies inert until an event fires off then it responds. You can't wake Access up and tell it to go do something. So, Protected Field has to lock itself when it loses focus.

Here's the problem. If a user unlocks the field but then decides not to make a change and clicks the toggle again to lock the field, first Access fires the script to protect the field (locking it), then it resets the toggle button, then it registers the toggle button click which unlocks the field. See the problem? If the user changes their mind about changing the field and then tries to lock the field, it ends up unlocked. I need something that will work whether the user is good about it or whether the user is in a rush and forgets about it.

View 2 Replies View Related

Forms :: Access Form With Tab Control Pages Each With Embedded Forms

Apr 13, 2013

I have an access form with tab control pages each with embedded forms.In one page I have a list of records as a datasheet form with the record identifier field configured as a hyperlink. When I click on this it passes its value to a form field in the form in the following tab page (works without the hyperlink but its a useful way of highlighting which field to click) which is a display/edit form of the details of the individual record. The Subroutine which does this sets the focus on this field it is passing the value to on the other form and the 'On Got Focus' event in that triggers the query that fills the editor form.

When I click back on the following tab to select another record to view/edit, the identifier value of the other record is passed to the other form but the data displayed in the rest form doesn't change. I understand this is because the field with the 'On Got Focus' never lost focus and so the query function was not called. To correct this I tried adding the same function call to the 'On Change' event however this does not work (the field is a text box set to 'locked' if that is relevant).I can get the form to do a new query properly if I click on a different field in the form before going back to the list tab or (as this is removing the focus allowing the On Got Focus to work again) if I click on a button to select a different record (which just takes me back to the list form).

Is there any way I can get this to work without having to manually remove the focus from the problem field? I have tried setting its On Got Focus event to move the focus to another field after the query function call however this prevents the Setfocus line in the code in the previous form from working. Here is a snippet of my code below.This code is for the list form and passes a value to the editing form:

Private Sub SalesID_Click()
Forms!Mainform.Requery
Forms!Mainform!Sales_Admin_Form!Sales_Admin_SalesI D.Value = SalesID.Value
Forms!Mainform!Sales_Admin_Form.SetFocus
Forms!Mainform!Sales_Admin_Form!Sales_Admin_SalesI D.SetFocus

[code]....

View 1 Replies View Related

Forms :: Cannot Set Focus To The Control

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

Moving Focus/control On Sub Forms

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

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 :: Can't Disable A Control While It Has Focus

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

Forms :: Can't Hide Control That Has Focus

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

Forms :: Data Entry Form - Set Focus On Tab Control

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

Forms :: Set Focus To A Specific Page On Tab Control In Access

Apr 24, 2014

If there a way to set focus to a specific page from a command button on a Tab Control?

I tried Me.TabCtl0.Value = 3.

But it doesn't work.

View 7 Replies View Related

Switching Problem Between Tabs On A Tab Control

Nov 14, 2004

I have setup a tab control with three tabs. Can I use a command button placed on tab #1 to switch the focus to tab #3? If so, how?

View 1 Replies View Related

Forms :: Reset Value Back To Previous Value If Not Valid And Then Change Focus To Another Control

Oct 21, 2013

I have an unbound form with a combobox which needs to be validated before the control is updated.In the Before Update event I check that the value is valid and need to reset the value back to the previous value if not valid and then change focus to another control.I thought that the following code would work but the selected value remains in the control and I cannot move the focus to another control.

Code:
Private Sub cboYears_BeforeUpdate(Cancel As Integer)
Dim dteNewDate As Date
dteNewDate = DateSerial(Val(Me.cboYears), Month(Me.txtCalendarHeading), 1)

[code]....

View 7 Replies View Related

Forms :: Setting Focus To Control On Single Form Side Of Split Form

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

Tab Control Pages

Aug 29, 2006

Hi,


I want to open up a certain page of a tab control using VBA code.

For example: when user presses a button in a form, tab number three of a tab control opens in an other form.

Any help will be very much appreciated.
B

View 14 Replies View Related

How To Add Record Sources To A Tab Control Containning Several Pages?

May 14, 2007

my tab control contains several pages and each page contains several

controls. i set each control it's control source. but i couldn't find the

record source in the Tab Control Page Property. because of that problem i

couldn't see any records displaying in it's controls.

Answer for this problem is greatly appriciated....!

View 1 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

Control Focus

Oct 10, 2006

Hi all

when i double click on a control that stores a date, i open a active x calendar that i use on a pop up form. (i think its the cal.ocx in access 2003).

I have a few date boxes on my unbound form and i want to use the same calendar popup.

when the popup opens the focus moves to the calendar. i'm trying to put the date into the control i originally double click in.

Any ideas are much appreciated.

View 13 Replies View Related

Focus On Key Control

Sep 7, 2011

The following is contained within a Public Sub cmdSave_Click().Put focus on "key" control...Please define what is ""key" control"?

View 1 Replies View Related

Trying To Hide Control That Has The Focus

Aug 30, 2006

Hi,

I tried hiding a list control by setting its visible property to Flase in VB; however, it keeps returning a message: You can't hide a control that has the focus.

I don't know who to move the focus from my list control before hiding it. I searched in the MSDN online, but with no luck.

Any help will be very much appreciated.
Thanks,
B

View 8 Replies View Related

Can't Move The Focus To The Control

Nov 7, 2007

Hi

I am trying to write simple code that undoes entering a new record and moves the focus to a mandatory field. I wrote the code below; however, I get this run time error message each time I run it.

DB can't move the focus to the control PlotNum.

My code:
Private Sub cmbHouseType_BeforeUpdate(Cancel As Integer)
Forms![frmHouse]![qryHouse2]![PlotNum].SetFocus
If Forms![frmHouse]![qryHouse2]![PlotNum].Text = "" Then
Cancel = True
Me.Undo
MsgBox "Please enter the Plot Number first, then enter the House Type"
End If
End Sub

Any help will be very much appreciated
B

View 4 Replies View Related

Disable A Control While It Has The Focus

Jul 21, 2006

I understand that I cannot change control.enabled to false while the control has focus.

Does this mean that if I were to make a form with only one control that can have focus then I cannot disable said control?

I'm used to plain old VB6 and am unfamiliar with this restriction :mad:

View 3 Replies View Related

Change Focus On Tab Control

Oct 17, 2006

I have a form with 2 tabs and a sub form on each of those tabs. form1, subformA, subformB on tab control - tabctrl - pageA, pageB. How can i set focus from one tab to another without actually clicking the tab?

I tried this:

TabCtl.Pages("page2").SetFocus

It's comming up with an error - "object required"

I also tried:

page.2.setfocus and that's comming up with an error that it's wrong syntax.

I also tried:

formMyForm.page2.setfocus and that says object required as well.

View 7 Replies View Related

Modules & VBA :: How To Know When Control Has Focus

Sep 12, 2013

In the following code, i am trying to determine if command button has the focus:

Private Sub lstOrg_LostFocus()
If Me.cmdEditOrgProfile_GotFocus() Then
Exit Sub
Else
Me.cmdEditOrgProfile.Enabled = False
End If
End Sub

The second line returns error.

How would I know if a control has the focus?

View 2 Replies View Related

Hide Focus With Control Error

Jan 26, 2005

I have read the threads on this subject and I thought I had my coding fixed, but obviously not, beacause I still get the error, "You can't hide a control that has the focus". Maybe it is a form/subform thing.

Here is my code:

Private Sub txtAge_AfterUpdate()
If Me.txtAge > 39 Then
Me!subfrmVersion.Form.chkWellness.Visible = False
End If
End Sub


txtAge is on the main form and chkWellness is on the subform.

Any help would be appreciated.

View 2 Replies View Related

Access Can't Move Focus To Control

Jun 24, 2005

I have a tab control on my form. In the change event of the tab control I am trying to tell it to move to the first field on each page of the tab control whenever the page no. changes:


Private Sub TabScreenAssess_Change()
'when a new page gets the focus, set the focus to the first control on that page
Dim PageNo As Integer

PageNo = Me!TabScreenAssess.Value
Select Case PageNo
Case "0": gynFemale.SetFocus
Case "1": tbPriorHx.SetFocus
Case "2": suSubUseAssess.SetFocus
Case "3": mhaCognitiveFunct.SetFocus
End Select

End Sub

This works when I am tabbing normally through the controls. But when I click back to the first tab, it says "Access can't move the focus to the control gynFemale" (gynFemale is the first control on the first tab.) It works for the other tabs. That is when I click on another tab, the focus goes to the first field on that tab. When I enter a value in the gynFemale field (it is a combobox, with options Yes or No), sometimes it appears to save the value, then I discover that it has been saved as record #0.

Any help with these problems is appreciated.

View 2 Replies View Related

Modules & VBA :: Set Focus On Control After Update

Jan 15, 2015

I have a continuous form populated with a pivot view from SQL. When I enter data in the form I send the data to SQL (ctrl after_update) and then re-populate the form. It works.

When I have entered data in a ctrl - then I have to bookmark the record so I can select it again (find_first). I can "save" the location of the control where I have entered data, but I want to select the location where the user has set focus - which triggered the ctrl after_update..My ctrl after_update looks like this:

Code:
txt_account = Me.Parent.txt_account_id.Value
txt_cost_center = Me.ActiveControl.Name
Call update_data_input(Me.ActiveControl.Value, Me.account_id.Value, Me.ActiveControl.Name)

[code]....

View 6 Replies View Related







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