Requery Moves Focus To First Record
Oct 31, 2006
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.
Thanks
View Replies
ADVERTISEMENT
Sep 2, 2013
I have a form which has 3 subforms based on a table with a combo box. When I select value from the combo box the data on the subform changes accordingly using the 'Requery'. However, they also show the record from the 1st value of the combo box. Is there a way I can get this solved?
View 1 Replies
View Related
Mar 17, 2013
I have a Dynamic Search form, which I use to search for client, on the double click it takes me to the client, at which point I have the Forms Visible set to False.
When I click on a button to open that Form, the Visible turns back to True, however it shows my last search results, how do I clear it so that when I call it back up it is ready to search again, and my focus is set to the SearchFor box.
View 3 Replies
View Related
Jun 2, 2005
I have a tabbook on a bound form, and an unbound combobox just before the tabbook. Whenever I tab or enter out of the combobox the form goes to the next record. Is this supposed to happen? If so, how do I stop it.
Many thanks in advance,
Aidan
View 4 Replies
View Related
Sep 20, 2005
Hi,
I have a form with some bound fields and some unbound fields. If I make any change to the bound fields I can use the "Before update" event to perform some actions when a user tries to move onto a new record.
What I now need is if a user doesn't make any change to the bound fields but makes a change to an unbound field - how can I check this before the next record is displayed. Is there any event I can use? Each time a user tries to move to a new record I want to check first if they have added anything to an unbound field.
Users can move onto the next record using buttons or the record navigator at the end of the form.
Many Thanks,
View 8 Replies
View Related
Sep 20, 2012
My form has been set up to enter and display info.However, the table it goes into is not populating until the user has finished his/her session and closes the form down. We need this info to update earlier, preferably on entry, as we require certain elements to be able to populate other forms.
The MainForm displays all information and the School or Team name is entered through this form, going into the School or Ministry table.This generates an autonumber which is then used in the TeamMember table to identify team members within each team. the only way we have access to this autonumber is by shutting the mainform down and then reopening it. Which event in the property sheet do I require to get the table to populate when the user moves onto next record?
View 1 Replies
View Related
Aug 20, 2012
I have a form with three subforms (Request, Employee Availability, and Employee Assign) in the image below. The user enters the ID in the Assign form (#4) which relates to the request at the top. When the user moves to the next record I want the value of the "Assigned" field at the top to be updated to "yes" for the record with the same ID as enter below.
In the end the following item with disappear when you return to the record: ID #4, Employee ID 109187, and Request ID 2 from the below form. My problem is I not sure how to get the Request form to update after the user moves to the next record.
View 1 Replies
View Related
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
Sep 11, 2006
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
View 1 Replies
View Related
Jun 22, 2015
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
[Code] .....
View 5 Replies
View Related
May 15, 2005
Hi - My first time here, and I am fairly new to Access, but getting on OK. So as ever, be kind.
I have spent several hours reading this forum and learnt a few things, and been completely confused by other things. My Job is IT but Software, Networks etc configuration rather than programming.
I am trying to help a charity out by building a database for their Sportsday.
I have a Parent Form Called Team, with Sub forms in Tabs for Team Details, Competitors etc.
In the Team Details, They can Choose the Hospital and Team Manager.
I have a Combo box with a lookup query, which looks up the Manager. However, rather than just display a last name, I have changed the SQL behind the (Properties - Data - Row Source), so that I get a concatenation of the Surname and First name:
SELECT tblCompetitor.CompetitorID, [surname] & " " & [Firstname] AS Fullname FROM tblCompetitor ORDER BY tblCompetitor.Surname;
All Works fine
I know I can use a "Not In the List" command, but initially they want a button to open an Add Manager Form.
No Problem except when I close and try to enter the New Managers Details in the Combo Box and requery.
I have a button to close the Add Manager Form and requery the Manager Combo in the originating Form
Private Sub CloseCompetitorsEditPopUp_Click()
On Error GoTo Err_CloseCompetitorsEditPopUp_Click
Forms![frmTeam]![ChildTransplantTeam].Form![Manager] = Me.CompetitorID
(the Manager field is a lookup from the Competitor table)
Forms![frmTeam]![ChildTransplantTeam].Form![Manager].Requery
DoCmd.Close
Exit_CloseCompetitorsEditPopUp_Click:
Exit Sub
Err_CloseCompetitorsEditPopUp_Click:
MsgBox Err.Description
Resume Exit_CloseCompetitorsEditPopUp_Click
End Sub
This code works fine if I just use the Managers Surname as the Data Field, but leaves a blank field in the Combo Box if I am displaying concatenation, until I do some sort of refresh.
Any Ideas if I can do this seamlesly as it is driving me potty.
View 2 Replies
View Related
May 26, 2005
I have a form in spreadsheet view. Basically all I want is to update the information which is viewed, but Form.ReCalc doesn't requery the database. So I tried Form.Requery. But after doing Form.Requery, the first record of the form becomes the active record, and in some cases I have to scroll to see the record that was active before the requery. Is there any way to avoid this?
One possible I solution might be to requery that form and return to the record which was active before the requery. Here comes another problem. The form has a subform in spreadsheet view (which is viewed by clicking + to the left of any record in the first form). If I expand an record to view the sub form, it is also expanded after the requery, but I also want the main form to scroll down so the subform is fully visible (or as visible as it was before the requery), or alternatively, scroll down so the top most record in the main form that is visible also is the top most visible record after the requery. If this is not possible, maybe there is a way to make the record which was the active record before the requery to be the top most visible record after the requery.
Could someone point me in the right direction? Give any suggestion?
Any help is appreciated.
View 8 Replies
View Related
Sep 23, 2005
Hi. First off I want to say that these forums are a gold mine. You all do a great job. Keep it up!
I work at a University and keep a database of students. On the main form for the student, you select their name from a combo box and the whole form refreshes to show the data for your selection. There are four subforms that keep track of things like a questionnaire, career center visits, etc. The problem I am having is with the Career Center visits.
There is a button that allows you to make an entry into a log when they come into the career center. Clicking on it opens up a small window where you can put notes and with whom they spoke while they were here. Upon closing the window, it adds the entry to the log for that particular student. That all works great. Each student has their own log...all is good.
However, upon closing the window, the main form jumps back to the first student in the list. The entry is added to the correct student, but you must find the student from the combo box in order to see it. It is just annoying to have to do it and I would like to fix it. Can't figure out why it is doing it, though.
Any ideas? I would like it to add the entry to the student, and stay on their record.
View 5 Replies
View Related
Oct 6, 2005
I have a Form [customers], which contains a tabbed control and within one of the tabs I have a subform [Loans]. The Loans form is a "display only" form which lists clients loans. The loans can be updated or added to by a popup form which acts as a loan calculator. The "After Update" event of the popup form requeries the [customers] form when the amended loan record is entered via the selection of a new record on the popup. This has the effect of displaying the changed loans on the underlying [loans] form.
This works OK except that the record being displayed on the customers form immediately jumps to the first record in the customers table.
Has anybody any thoughts on why it would jump records after the requery and how I could stop it.
The requery code is as follows
Private Sub Form_AfterUpdate()
Forms![customers].Requery
End Sub
View 1 Replies
View Related
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
Jan 2, 2014
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.
View 5 Replies
View Related
Aug 17, 2007
Hello,
I have looked for ages for a solution to this and have not yet found one to suit me so here I am.
I am creating an Access 97 db in which I have a form (section1) which shows its records in datasheet format(results from a query). On this form is a button which opens another form (fileViewNewSec1) where the user can input the data for a new record. In the closeEvent() part of this form I have put:
=[Forms]![section1].[Requery]
This successfully refreshes the form and the new record can be found. However, there are many records in this database and it would be nice if once the form (section1) has been refreshed that it would focus on the newly created record. I am not sure if anyone can help me with this.
The records are sorted by "fileRef" and therefore the newly created record is not placed at the bottom of the records. They do however have an auto number primary key, I am not sure this will be useful but they you go.
Cheers
MArk
View 3 Replies
View Related
May 4, 2006
I have a subform where the user enters the number of training days on a quotation. After the record is updated I do a requery on a text boxt on the main form that shows the total number of training days ordered for that particular customer.
The problem is the focus then resorts to somewhere else on the main form but I want it to return to the same record on the subform. I have managed to get it to go to the first record in the subform but obvisouly from users perception that is not god enough.
I have got the following code in the sub form's after update event but nothing seems to work although I do not get any errors.
Private Sub Form_AfterUpdate()
If Me.TrgType = 1 Then
Dim rs As DAO.Recordset
Dim varBookmark As Variant
Set rs = Me.RecordsetClone
rs.FindFirst ("QuoteItemID = " & Me.QuoteItemID)
varBookmark = rs.Bookmark
Forms!frmCustomer!txtUnitsOrdered.Requery
Forms!frmCustomer.Refresh
Me.Bookmark = varBookmark
Me.QuotedPrice.SetFocus
rs.Close
Set rs = Nothing
End If
Any assistance would be most appreciated :)
And yes Ghudson I have done a search - LOL :p
View 1 Replies
View Related
Dec 3, 2013
When I click the button "open new order" after that my form it's open with new id and it's ok, but when I push the key "F5" then Ms Access goes to another record (no new record). Why is that?
View 4 Replies
View Related
Apr 19, 2006
I'm requerying a form after an update.
I would like to have the form to be set to its current record when being requeried. How can I easily achieve this?
I've seen things about recordsets, I'm working with ADP (based on SQL Server) and don't know or all DAO events will help me.
View 3 Replies
View Related
Nov 29, 2004
Hi,
I have inherited a buggy database thas has a simple piece of code that won't behave the way I think it should!
The code should add a new record and have that new record appear on the list form (where the button On_Click event is called) making it available for user edditing. In 99% of cases though, the blank new record does not appear. The record is getting created, as i can see it in the table and have added a watch to the RecordCount property, it just doesn't display automatically. The existing workaround for users is to click a second button that invokes a simple one line function sub that performs only a Me.Requery. The user presses that up to two or three times before the new blank record finally appears.
One solution I read about, but hesitated in trying due to the unprofessional 'flash' that occurs, was to close the form and the re-open it...anyone experienced this or can comeup with a neat workaround?
The code
Private Sub CmdAddRule_Click()
Dim db As AO.Database, intnextseq As Integer
Dim TestThis As String
Set db = CurrentDb()
Dim rstDao As DAO.Recordset
Set rstDao = db.OpenRecordset("select * from stblAllocRules order by intRUSequence desc;", dbOpenDynaset)
If rstDao.RecordCount > 0 Then
intnextseq = rstDao!intRUSequence + 1
Else
intnextseq = 1
End If
With rstDao
.AddNew
!AutRU_id = 0
!intRUSequence = intnextseq
!bytAppendBack = 1
!bytUpdateBack = 0
!bytDeleteBack = 0
.Update
.Close
End With
Set rstDao = Nothing
Set db = Nothing
Me.Requery
Me.Repaint 'I have used this staement in addition to and instead of the Me.Requery to no effect
Me.Recordsource = Me.RecordSource 'I have used this statement also in addition to the above to and in isolation, to no effect.
End Sub
View 2 Replies
View Related
Nov 8, 2014
I'm trying to execute some lines of code right after deleting a record in a subform, with a right click on the row I want to delete (the idea is that if a record is deleted the other ones should be updated by module1.tblUpdateLatestDocuments).
I've tried putting this code into the events On Delete and After Del Confirm of the subform, none of that worked.
Code:
Option Compare Database
Private Sub Form_AfterDelConfirm(Status As Integer)
Call Module1.tblUpdateLatestDocuments
Me.Requery
End Sub
Private Sub Form_Delete(Cancel As Integer)
Call Module1.tblUpdateLatestDocuments
Me.Requery
End Sub
Aren't there any events that I could use right AFTER the record has been deleted?
View 10 Replies
View Related
Jul 31, 2013
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
View 2 Replies
View Related
Dec 17, 2014
I have a form, with a subform,
When a user selects a record from the subform i use this to view the record in the main form
Private Sub Txt_Support_Name_Click()
DoCmd.ApplyFilter , "ID =" & Me.ID
End Sub
However when i select the record from the subform, it populates the form as required, however then the top record of the subform is highlighted.
Any way to either - highlight nothing, or highlight the selected row?
View 4 Replies
View Related
Apr 14, 2015
I launch a 'CreateNewRecords' form from a 'MainForm' form. When the 'CreateNewRecords' form closes, the new record is visible on 'Main Form'.The underlying query is unsorted, so this code in the AfterUpdate event of 'CreateNewRecords' puts the cursor on the last record displayed on 'MainForm', which is the newly created record:
Forms!frmMainForm.Requery
With Forms!frmMainForm.RecordsetClone
.MoveLast
Forms!frmMainForm.Bookmark = .Bookmark
End With
However, I intend to sort the underlying query, which means that a newly created record may appear in the middle of the records displayed on 'MainForm'.
What I want to have happen is that after a new record is created by 'CreateNewRecords', the underlying query is requeried so that all current records are displayed on 'MainForm' but also that the cursor rests on the newly created record (rather than default to the first record).
View 7 Replies
View Related
Jul 30, 2013
I have a Main form that has button that loads a new Pop Up form for entering new data that will display in the Main form. When all the data is entered I click on a button that Saves the data and exits the form and then runs Re-query on the main form returning to the record that was current before the requery.
I have the following code:
Private Sub cmdSaveTradeAndExit_Click()
DoCmd.RunCommand acCmdSaveRecord 'Save the current record
DoCmd.Close 'Close the current form
Dim CrId As Integer
CrId = Forms!frmTransactionMainActivePopUp.CurrentRecord
Forms!frmTransactionMainActivePopUp.Requery
DoCmd.GoToRecord , Forms!frmTransactionMainActivePopUp, acGoTo, CrId
End Sub
But I am getting the following error:
Run-time error '2498':
An expression you entered is the wrong data type for one of the arguments
And the following is in yellow in the debug:
Code:
DoCmd.GoToRecord , Forms!frmTransactionMainActivePopUp, acGoTo, CrId
View 4 Replies
View Related