Does anyone know how I can add a record to a subform that is in data sheet view with out giving the subform focus? I have tried the docmd.gotorecord but I keep getting an error that the form is not open. If i set focus to the subform and then use the docmd.gotorecord it works fine but I do not want to set focus to the sub form
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
I have a sub form on a tabbed control. In the subform I have some calculated controls and I make them recalc when ever data in other fields change bu entering a recalc cmd in the update event of the required fields. That is all fine but the problem is that the forms focus moves to the first record and I need it to stay on the active record.
I have tried requery, recalc and refresh methods and they all do the same thing.
All I need to do is up date the calculated controls each time a field is updated and stay on the same form but it's eluding me.
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.
I have a form with a subform which is sized to show several records at the same time. If Record A has the focus, and I click anywhere in Record B, then Record B gets the focus, as expected. ... Except if I click on an Image field in Record B, when the focus stays on Record A.
How I can force it to set the focus to the other record ? I don't think this can be done with Events handlers, as they need to have the focus set first.
On a form (default view: Single), I have a bunch of bound controls that display one record at a time from tblMain. I have a bunch of unbound controls as well (buttons).
If the user tabs through all the controls, reaches the last one (btnLast), and presses tab again, the focus is set to the first control (btnFirst) and the bound controls change to display the next record. I just want the focus to be set to the first control without the displayed record being changed.So I set up an "If" statement in Private Sub btnFirst_GotFocus()
Code:
If Screen.PreviousControl.Name = "btnLast" Then [code to change record back to previous record] End If
But btnFirst gets the focus when the form opens, so Screen.PreviousControl spits out an error.I've accommodated this like so:
Code:
On Error GoTo ErrorHandler If Screen.PreviousControl.Name = "btnLast" Then [code to change record back to previous record] End If Exit Sub ErrorHandler: Exit Sub
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"
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
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 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!
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 ?