Focus Issues: Disable Me Please!

Nov 1, 2004

i have a box that starts as locked and disabled. when a button is pressed, the box unlocks and enables. i would like for the box to re-lock and re-disable when the user updates or leaves the box.

three things can happen from here:
1) user leaves box without changing anything
2) user changes something and hits enter or tab, updating field
3) user changes something and clicks something else without updating (which i think is updating anyways)

problem:
issue 1) is fine. nothing wrong here. issue 2) is ok too. however, issue 3) is eating me alive. i've tried to set the focus to something else using the OnExit and OnLostFocus events. however, i get this error in the AfterUpdate event: "Access cannot move the focus to the control Button1". why?? my code is as follows:

Code:Private Sub Field1_AfterUpdate()Button1.SetFocusField1.Enabled = FalseField1.Locked = TrueField1.SpecialEffect = 0

Thanks for your help in advance! (And I apologize if this is something so obvious you just wanna punch me in the face)

-Jason

View Replies


ADVERTISEMENT

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

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

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

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

List Box Focus

Nov 8, 2005

Hi

I have a list box setup with all the dates from 01/10/05 to 31/12/08.

I want to always start the list box at the current date while still allow the functionality to backdate if required.

I have used the undernoted code to set the row correctly but I cannot figure how to get the box to scroll down to the correctly selected row.

Dim i As Long

i = DLookup("ID", "tblIMDates", "cdate([Date])=date()") - 1

Me.lstDates.Selected(i) = True

Any ideas?

JC

View 5 Replies View Related

Set Focus To The First Field

Mar 7, 2006

I moved the Address field from third postion to first position, so that clicking on a list box places the address from the List Box into the Address field. I adjusted the bound and source boxes and it works perfectly. The cursor now points to the Last Name field (second position, which it did originaly.) I would like the cursor to point to the Address field so as not to confuse the operator. How can this be accomplished? I am sure the correct Event code will do the tick.

View 2 Replies View Related

Got/lost Focus Help Please

May 18, 2006

Hi there.

I have a form and on open it traps the user into a combo box where an option must be selected before they can move to another field. I did this by using the lost focus event of the combo to check if an option has been selected and then return the cursor to the combo if no selection has been made.

The problem is that there is an exit button on the form which the user must be able to use to exit the form without interacting with it, say if they opened the form by mistake and just wanted to exit immediately.

I cant find a way to trap users into selecting an option from the combo before filling the rest of the form while still allowing the exit button to work. At the minute you still have to select an option in the combo even if you just want to exit the form.

I have been a notes developer for years so I’m still not that familiar with access and the way its events work so this could easily be a gormless question. Feel free to point that out. Any comments would be much appreciated.

View 3 Replies View Related

Setting Focus

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

On Got Focus And On Click

Jun 5, 2006

I am trying to perform a Function when ever someone clicks_on or tabs to a text box
So I set the following on the event Tab

On Got Focus = Calendarfor([txtDOB])
on Click = Calendarfor([txtDOB])

The tab part works great but if the user click on the text box first then it calls the function twice

I know the reason is that if the user clicks the text box first access it saying that
Got Focus and Click events are triggered thus it runs the function twice.

How can I prevent the function from executing twice when a user clicks on the text box first??

View 1 Replies View Related

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

Determining Focus

Jan 4, 2007

Is it possible to use the "On Lost Focus" event to determine which control now has focus?

View 6 Replies View Related

Keep Focus In Listbox

Oct 25, 2004

I am working in a county jail and we are doing a database where you select the living unit location (example: 1A,1B,2A,2B) from a listbox. The problem is that most entries are multiples on the same unit. I would like the unit selected to stay as the current default when the next record is started. As it stands now, as soon as you enter the record, all focus in the listbox is lost. (example, there are 3 items on 1A. After 1st item is saved in record, 2nd record should start with 1A highlighted (selected?) in text box rather than having to click on it or select it) Is there a way to do this? This would greatly improve my data entry time. Thanks in advance!!

View 2 Replies View Related







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