Error '2110' Cannot Move Focus

Jan 11, 2006

Hello all,

I don't like the look of Combo boxes on forms, especially on Continuous forms made to look like a spreadsheet. I think the arrow is distracting, and since you cannot change its color frequently looks bad. My plan was to use two controls - a text box, and a combo box. I would have the combo box hidden and the text box visible. When the user clicked on the text box, I would make the combo box visible, and hide the text box. Then, when the user left the field, I'd hide the combo box and reveal the text box.

Here is the code I used:

Private Sub cboPlayerID_LostFocus()

Me.txtPlayerName.Visible = True
Me.txtPlayerName.SetFocus
Me.cboPlayerID.Visible = False

End Sub

Private Sub txtPlayerName_GotFocus()

Me.cboPlayerID.Visible = True
Me.cboPlayerID.SetFocus
Me.txtPlayerName.Visible = False

End Sub


The first procedure runs fine, and when I click on the text box it changes to a combo box. However, when the second procedure runs, I get error 2110, cannot move focus.

Any ideas why I get this error, or any ideas of a better way to accomplish this??

Thanks,
Eric

View Replies


ADVERTISEMENT

Forms :: Runtime Error 2110 But Only On Last Control

Mar 24, 2015

While I have developed many databases using other RDBMSs I'm afraid I'm something of an Access 2007 newbie so the vast bulk of my experience counts for nought given Access' many "unique features".

What I have is a form with about 3 text fields, 2 date fields and a number of comboboxes on it. Although, for now I'm not worrying about the combo boxes until I get the other fields working.

I am trying to develop an update screen where the user types the primary key value for a record into the first field and using DLookup retrieve the other values from the table and insert them into the form so the user can adjust them if they wish and click the Save button to write the changes back to the table. That's the theory.

Unfortunately the reality is, although the values added to the other fields using DLookup are "there" they don't appear on the screen until the controls lose focus. My best guess is because they are being added programatically and no Return key is being pressed, focus will not change and they will never appear.

So to get around this I put a line of code in the GotFocus event of each control to move focus on to the next control, effectively "looping" the focus once around the controls. This worked well until the focus was being moved from the second last control to the last control when I got, Runtime error 2110: Can't move focus to this control. The control was visible and enabled, as was a dummy control I tacked on the end to see what happened.

Main code block in Exit event of first field:

Private Sub Text6_Exit(Cancel As Integer)
Dim varItemType, varItemTypeCode, varItemClass, varItemClassCode, varDescription As Variant
Dim varPurchaseDate, varWarrantyEnd As Variant
Dim varItemTypeTxt As AcTextFormat
Dim PurchaseDateSQL As String

[code]....

View 5 Replies View Related

Forms :: Runtime Error 2110 In Search Field

Dec 19, 2013

I am getting a runtime error '2110' - access can't move the focus to the control SearchResults.

This ONLY happens when the first character I type in the SearchFor field is the letter "I". All other characters do NOT give the error.

Why it only backfires on character "I"?

The Form has Search field [SearchFor] and a List box [Searchresults].

A requery occurs after every new character in [SearchFor].

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

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

Forms :: On Got Focus Move To New Record

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

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

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

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

Move DB

Aug 21, 2007

I need to move my database from one computer to another and will need to put it on disk first. I have user serurity on the DB. Should it be ok as long as I put both files (the Db and the security) onto the disk and transfer them both?

Just asking as I cannot copy to CD from my computer and will have to put a request in so dont want to have to keep going back.

View 2 Replies View Related

OK - Move HELP!

Jan 10, 2006

hiya all! i need some help!

i want to make a button on my "Calls" database form, to move all "Finished" calls (calls that have been declared as completed), into a "Finished Calls" table.
I have half of it working - i have a button that DELETES all 'Finished' calls. However i now need them to COPY into my "Finished Calls" table... is it an Append Query i need?

the code i have now is as follows...

SELECT * INTO Table2
FROM Table1
WHERE Finished='Yes';

thanks in advance!
johnny

View 5 Replies View Related

Move Up And Down

Nov 16, 2006

Hello all

Got a question that I've never seen done in Access....
I have a DB I'm creating that creates pickup runs....(guy goes out and collects stuff) I'll need to get a subform showing the run items and be able to move them up or down according to the way in which the driver is going to do the run

Any ideas guys?
I've got no idea where to even start

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

Focus On A Form

May 26, 2005

How do i choose the field i want my focus to be on when a form i opened?

View 1 Replies View Related

Object Focus

Jul 8, 2005

I'm trying to force a user to enter text into a field. To this end, I've created a subroutine for the exit method of the text box they are supposed to fill out. I check to see if the .text property is null, and if so create a message box that pops up a notification telling the user they need to fill in said field. After that, I try to use the Me.txtReason.SetFocus (the text box is called txtReason) to return the focus to that text box, but instead it moves on to the next text box. Is there a way I can prevent the user from leaving the text box until they've entered some sort of data into it?

Thanks,
Dave

View 4 Replies View Related

Outa Focus~~~~

Sep 14, 2005

Little problem with a form and subform. Problem is...I don't know why I'm having this problem! :)
Have a form with a subform. Everything is working correctly,with one exception. The form is entering payments (checks) then the subform handles the distribution. So after you input one or more lines on the subform you click the "new record" icon. Problem is the focus stays in the subform and not to the top of the main form. I know I could code it to force it to set focus to the first field on the main form... BUT.. I've done this before and coding was not needed. So what did I do wrong on this one?
Thanks

View 6 Replies View Related







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