Im having an issue where if i delete the contents of a field then click on a custom toolbar that calls code back in the main form (say to go to a new record), if i try validate the value of that field before loading the new record its still its original value! ie before i deleted it. Im pretty sure this is becuase the field has not yet lost focus. If you do the same test but click on any other control in the form to call that validate piece of code the field has now lost focus and the value of it is deleted as it should be.
Often I use Labels as buttons due to the fact I can colour them the way I want, and use the on click event to trigger code. The code below however works for a command button, but not a label button.
DoCmd.OpenForm "frmdatetime" Do While Forms!frmdatetime!OKFlag.Caption = "False" DoEvents Loop
When this code is run by clicking on a command button, it works fine. If run by clicking on a label, frmdatetime opens, but the mouse will not work on either of the 2 open forms unless you go down to the windows task bar, jump onto another window, and back onto frmdatetime. If I remove the loop with the DoEvents in it, then the problem does not occur.
Can anyone enlighten me as to why this behaviour occurs.
I have a memo field that that I would like to allow the user to right click on, then it opens a File browser for them to select the location of the file they are looking for. that way, they can double-click on the location later and find what they need (for reference). What would be the best approach for this? And do I need some sort of generic File browser code? Please advise. thank you.
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!
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.
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?
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"
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
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
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?
I am very new to Access and have a problem with focus in my secondary form (sorry probably wrong terminology).
I have a main company form with a button which links to a contacts form created through a query.
I cannot get the second form to focus from the first form i.e. Company A when i try to add or look at contacts assigned to Company A in the second form the (Autonumber) appears in the field, not the autonumber given to it from the company table.
Hope this is clear! I dont know any programming but feel fairly confident with the expression builder and properties box.
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.
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.
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?
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
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.
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.
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 ?
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.
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!!
Hi, this is frustrating, and a little complicated, so I'll try and explain it as best I can..
I have a form with two sub forms.
The main form "fmMain" contains a list of species. the subform which is causeing me the problems lists loci specific to each species. The user can search by a species or locus and resrict the list accordingly.
Now, here is the problem. The form is too large for my screen, so I have some scroll bars on fmMain. However, whenever the user performs some kind of search the focus shifts to the subform (I guess), causing the screen to scroll to the middle. From here you can't see the species info, and after each navigation the user has to scroll back up again. It's frustrating having to continually scroll around the screen.
Is there anything that can be done to stop the focus shifting around? I'd rather that when the user performed some action the screen just simply didn't move.
Cheers - sorry for the monster post! (hope it all makes sense)