Forms :: Requery Moves The Record Back To 1st Record
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?
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.
Bit of a problem I'm hoping someone can help with. I have a telephone call logging system. The system is a tabbed form with each tab representing a person's Telephone Call Inbox. As new calls are entered into the database, they appear in each person's inbox until they are marked as dealt with.
This all works fine and there are no problems with the basics of it, but the problem I do have is that after I have split the database into a Back end and a Front end and distributed the Front ends to each user, when a new call is entered it doesn't appear in the persons inbox until they do a requery.
At first I sent the form to requery using the ontimer event, but the problem I have is that after every reqery the form goes back to the first record. A user on the office forum suggested I use the following code:
When I add a record in the subform and then move to the next record whilst still in the subform, the main form jumps back to its first record? I then have to move back to the right record in the main form to update the next record in the subform.
I want to move to the next record in the subform without affecting the main form.
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.
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.
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?
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.
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?
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).
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
I am preparing a database to track the daily activities of my team. This is a real time database wherein the users will add their daily ongoing task and submit.
The action for me is, I need to capture the time required for each task.
Also, there is a possibility that the user will have to hold a task for a while/days due to some issue and will start another task. Once they have a feedback on the issue they will resume the pending/holded task.
Here, I need to capture only the time they have invested in performing the task and ignore the time spent to receive feedback on the issue. Hence the time should start when they start the activity and pause when they hold the activity. Again, the time should continue where they had paused, when they re-start the holded activvity and finally ends when the submit.
I have a form (frmAddManifest) with a subform (subfrmManifestTransporters).
When creating a new record, I can enter data into frmAddManifest, but the subform doesn't update to link with the record - I presume it's because the record from the main form hasn't been completed yet.
Is there a way to requery the form and/or subform so it stays on the record I was working on, and link the subform properly?
I have two sub forms on a main form.Subform 1 displays information which comes from a query, filtered using two combo boxes on the same form.The active record on the data sheet has two field values output to hidden text boxes on the form.
These text boxes then provide the values used for the query displayed on the 2nd sub form.When I highlight a new record in subform 1, the text box values change, but the values in sub form 2 do no.Which would be the best method to use to get this to requery?
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
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.
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.
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.
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
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.
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
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?
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.
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
I have a subform (continuous) which shows a summary of all clients basic data in a list. Clicking a client requerys and refreshes some other subforms so the accompanying data for that client is shown. Whenever I double click a record, the "main" window for that "object" opens. So say I double click on client A1 in the summary list, a form opens where I can view all the clients data and change it if necessary. That same form is also used to add clients to the database.
Whenever I change or add a clients data and close the form, the following code is executed:
Private Sub Form_Close() On Error GoTo ClientsAdd_Err
ClientsAdd_Err: MsgBox Error$ Resume ClientsAdd_Exit End Sub
Which makes the new client appear in the summary list or makes the changed data of an existing client appear in the summary list. That's what I want it to do of course.
But whenever that is done, the cursor jumps back to the first record (client 1) in the summary list. What I would like to have happen is:
- when a new client has been added, keep the cursor on that client in the summary list after the form closes and the list is updated.
- when a record of an already existing client is changed and the form closes, keep the cursor on that client in the list also.
DoCmd.GoToRecord acForm, "ClientsViewSummarySubForm", acLastgives "The object ClientsViewSummarySubForm isn't open. As does the same line of code but then using the name "ClientsViewSummary". The form itself is called that way. The subform object itself goes by: "ClientsViewSummarySubForm".
I've tried some variations but all without succes. Which line of code is the correct one to use for a subform on a parentform instead of "just" a normal, open form?
Every time I enter the value for the OservationType in Subfrm it jumps back to the very first record. Can any body help me solving this problem. I thought it is tub order issue but it is not. I attached the sample db to this email. Please, help me. Thanks.