Stay on the same record

In a form, I have many records, with a scroller.
When I make a modification on one, I have this code
     Me.Requery
to see the effect of my modification. But with that command, my pointer is
back to
the top of my list .
Any suggestion to stay on the same record I have modified, after the
modification?

Best regards



0
Pierre
3/10/2007 5:36:40 PM
access.forms 6864 articles. 1 followers. Follow

3 Replies
2256 Views

Similar Articles

[PageSpeed] 19

You could also try the following:

Dim r as Long
    r = Me.CurrentRecord
    Me.Requery
    DoCmd.GoToRecord , , acGoTo, r

"Ofer Cohen" <OferCohen@discussions.microsoft.com> píše v diskusním 
příspěvku news:D69A1729-D63E-4B19-941F-2B7A51CF8663@microsoft.com...
> Check help on Access BookMark
>
> -- 
> Good Luck
> BS"D
>
>
> "Pierre-Yves Ste-Marie" wrote:
>
>> In a form, I have many records, with a scroller.
>> When I make a modification on one, I have this code
>>      Me.Requery
>> to see the effect of my modification. But with that command, my pointer 
>> is
>> back to
>> the top of my list .
>> Any suggestion to stay on the same record I have modified, after the
>> modification?
>>
>> Best regards
>>
>>
>>
>> 

0
Utf
3/11/2007 8:18:41 AM
In news:ezpFgX7YHHA.688@TK2MSFTNGP03.phx.gbl,
Vladim�r Cvajniga <nospam@thank.you> wrote:
> You could also try the following:
>
> Dim r as Long
>    r = Me.CurrentRecord
>    Me.Requery
>    DoCmd.GoToRecord , , acGoTo, r

That won't work if some other user has added or deleted records from the 
recordsource since it was originally queried.

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


0
Dirk
3/11/2007 7:20:33 PM
In news:P1CIh.119415$1h1.856446@wagner.videotron.net,
Pierre-Yves Ste-Marie <stemariepy@videotron.ca> wrote:
> In a form, I have many records, with a scroller.
> When I make a modification on one, I have this code
>     Me.Requery
> to see the effect of my modification.

Do you really need to do this?  Would Refresh and maybe Recalc do as 
well?

> But with that command, my pointer is back to
> the top of my list .
> Any suggestion to stay on the same record I have modified, after the
> modification?

The safest method, if you must requery, is to save the primary key of 
the current record before you requery, then relocate to that key 
afterward.  Here's a basic outline of the code:

    Dim vID As Variant

    ' Save the current record's primary key.
    vID = Me.ID    ' where ID is the primary key field

    Me.Requery

    Me.Recordset.FindFirst "ID=" & vID

If the primary key is a text field, you'll need to enclose it in quotes 
for the FindFirst criterion:

    Me.Recordset.FindFirst "ID=" & Chr(34) & vID Chr(34)

-- 
Dirk Goldgar, MS Access MVP
www.datagnostics.com

(please reply to the newsgroup)


0
Dirk
3/11/2007 7:24:33 PM
Reply:

Similar Artilces:

Getting the prev record value
Good morning and thanks for reading this. On my form I have a sub form. In that sub form I have 4 fields I'm using. PrevBal Earned, Used, and Bal. When I do the calculations on the current record every thing comes out correct. Where I'm having the problem is when I go off that record and go back in at some point in time I can not calculate off the previous record balance. I've tried this code and it doesn't work: =GetPreviousValue([frmfurlough3], "bal") I'm trying to calculate like this: bal = PrevBal + earned - Used In this statement the PrevBal ...

Subform New Record
Is this possible? Form A opens to job number from switchboard selection with all related data from job table. Form B, which is a subform on Form A, opens for tech to enter name and time started on job. If Tech1 has already started time on job and Tech2 wants to help on same job, it opens with Tech1's time. I need Form B to open to a new record for Tech2 to enter time, but Form A still relate to job number selected from switchboard. Thanks in advance for any help, Pam Open Form B in design view, and set its Data Entry property to Yes. Now the subform will alway...

want header stay stay when scrolling
I am battling to get the heading of the page to stay when previewing site design, how do I freeze the header or top pics You'd need to use frames, Pub doesn't "do" frames...except for iframes. ps... frames are bad news, you shouldn't use them unless you are prepared to deal with problems they can cause. "Mark" <Mark@discussions.microsoft.com> wrote in message news:1A34CB04-C8D3-4FCA-97DB-7E16E6EB7623@microsoft.com... |I am battling to get the heading of the page to stay when previewing site | design, how do I freeze the header or top pics Rob, ...

Need to update records in a table based upon records in another ta
Hello, I am using access 2003. I have a table called tbl_Master which contains fields such as DeviceSN, Name, SlateForRetirement?, Flag1, Address and City. The unique record is DeviceSN. The data in this table is old so I performed a walk through of the office and created a spreadsheet with updated information. I imported this spreadsheet and called it tbl_ImportedUpdatedInventory Can you help me with detail instructions on how to create a query that will upate the master table with the fresh information i.e. Name, Address, City, SlateforRetirement from the imported table? Y...

stay on same record
I have a main form with a subform control. I have several subforms that I switch in the subform control using a combobox. I pull up a record from the main form (main table=tblClients) using a combobox. The problem is when I switch the subform in the subform control, the record on the main form always goes back to first record in the table. Is there a way I can stay on the same record I am viewing when the subform is switched? You might have in your code Me.Requery That will make the form move to the first record. If that the case, is it necessary to run the requery? -- Good Luck BS...

Mail stays in outbox #2
When I click on Send to send a message, I get the error "Some errors occurred while processing the requested task. Please review the list of errors below". There is nothing listed below. My message goes to the outbox and it is sent everytime I click on Send/Receive. I continue getting the error and the message continues to be sent until I delete the message from the outbox. I am running Outlook Express 6. Any suggestions? Thanks Try posting this in an Outlook Express news group - this is not one of them. Outlook is a part of Microsoft Office and is what this group suppor...

Record Level Security
Has anyone done record level security (not gl segment, not field level) This is a general inquiry, not a crisis. I'm looking for direction on ISV or other solutions completed. Are you talking about an audit of changes to a record? Or the ability to have a user be able to access some records (such as some Vendors, but not all Vendors)? Regards, Brenner "Lpgiesen" wrote: > Has anyone done record level security (not gl segment, not field level) > > This is a general inquiry, not a crisis. I'm looking for direction on ISV > or other solutions completed. ...

How to return records based on a calculated field
Hi, I have a query that returns the following records: txtRecNumber RSum 8 3701 7 3030 6 30 5 0 4 769 3 0 2 1426 1 3800 "txtRecNumber" is the Record Number in Decending Order and "RSum" is a calculated field. I want this query to return all the most recent records which RSum is above the most recent "0". In this example it should return 3701, 3030 and 30. How do I edit my...

My mail stays in the outbox
I tried to send 3 e-mail messages. They are in the outbox and say that they have not been sent. I have done everything I know to get them to go but they are still stuck in the outbox.HELP! You might check under Tools>Options, then the Send Tab. Make sure there is a checkmark in the "Send Messages Immediately" box. Then when you click send button they should move out of your Outbox and be Sent. This would be one of the first things to check, that is if you are not receiving some kind of error message along with this. HTH, James "Cindy" <Cindy@discussions.mi...

CRM3: SHARING RECORD
Hi to all, i would like to use the sharing function in this way: when i share an account i would like that all the related entity will be shared, at moment i see that it shares only the account record and all the quote, orders and so on will not be visible to the systemUser who receive the sharing. Anyone know how to do that ? Thank's to all Jumpa there is no cascade sharing... to do this, you have to create a callout "Jumpa" <Jumpa@discussions.microsoft.com> wrote in message news:E8189BBE-541A-4BED-901D-52215A9F2F69@microsoft.com... > Hi to all, > i wo...

Outlook hangs when accessing CRM records
Hi, We have a user with CRM desktop client, who can use outlook normally, and even view CRM folders and records list. but once she try to open a record (no matter which), outlook freeze and has to be killed via task manager (though it doesn't show any abnormal CPU or memory use). I tried to uninstall and reinstall the client, checked for pop blocker and IE security setting but all seem normal. I should note that this user is able to work with web client form that same computer, and that other users work with their outlook client from their computers with no problem. any help would be appr...

Cursor position doesn't stay put when revealing hidden text
Word 2003--In a long document with lots of hidden text that codes many table of authorities entries, when you press "show hidden" the placement of the cursor stays at the same position on the page instead of staying with the word I left it on. How can I make the cursor stay where I left it? -- Janet N.--Legal Sec''y Appellate Specialist ...

stays in outbox
Does anyone know why sometimes when I send an email it just stays in the outbox.. Sometimes it is when I reply and sometimes it will happen if i create a new email and try to send it. I am using Outlook 2002. I have it set to send immediately. thanks ...

Records not being delete in CRM 4.0
We have records in several entities with DeletionStateCode = 2, but none of these records are actually being deleted. SQL Server agent reports that MSCRM_CONFIG.SiteWideCleanup (p_CleanupSiteWideNotifications ) and MSCRM_CONFIG.HardDelete (p_HardDelete) are running regularly without error. Does anyone have any idea how to start troubleshooting? Do you have an event logged? Check out the issue blogged here it may be of some interest: http://ronaldlemmen.blogspot.com/2006/10/error-deletion-service-failed-to-clean.html Regards Marion "Jordahl" wrote: > We have records in se...

Form, Subform, and Record Navigation
It seems that when a subform displays in datasheet view, and the focus gets to the new record row, if I continue to press the <Enter> key, when the last field is reached, the focus transfers to the main form and goes to the main form new record (or next record). But in my other form, where the subform is a continuous form made to look similar to datasheet view, when a new subform record is reached, and the <Enter> key pressed repeatedly until the last field is reached, the focus stays in the subform, and simply moves to the first field in the new record row. How can I get the lat...

Taskbar not staying hidden
This has happened to me with XP, Vista, and now Win 7. When I set the taskbar to auto-hide it will work for a while and then the taskbar will stay up all the time. I have to go into Properties (the settings are still as they should be) and uncheck auto-hide, save it, then go back and check the auto-hide and it will work again for a while. What gives? Suggestions please. Thanks in advance... Bob "Bob Newman" <bobnewman@cox.net> wrote in message news:n1M4n.21900$DY5.18492@newsfe08.iad... > This has happened to me with XP, Vista, and now Win 7. When I ...

Find distinct records of the last order from a customer
Hi I am trying to find a list of customers that have not bought anything for the last xx months. I have a salesorder table which holds an orderdate and customer account code, other customer details are held in the customers table. i have a table called soitemsdespatch thats holds the parts that have been sold to that customer. salesorder and soitemsdespatch are linked by sonumber. I was hoping that would show me the last orderdate for all customers and list them in order but it repeats customer orders but not all of them. What i would really like is one query that would show m...

Before Update on record select
I am getting no where fast. I have a main form and sub form and what i need is a message to appear when user moves on to the next record using the record selector on the bottom of the form. I have tried the beforeupdate on the form but no results. Can form design prevent a message prompt? One problem is that if no changes to the current record have been changed, the Before Update event will not fire. If you do make a change, the code as is should work. I have gotten into the habbit of not using the standard record navigators, but write my own so I can easily deal with this. -- Dave Ha...

Form not displaying records
Hi. I have a form that is opening blank in form view. All my objects are on the form in design view. I have checked the Allow Additions property which is Yes and checked the recordset is updateable, which it is. I can see the record when I change to Datasheet view. Can anyone advise how I get my form to display properly? It seems quite a simple task but I just cant figure it out!! Cheers, Steve. I knew it was a simple problem!!! I had the Visible property for the Detail section set to No. D'oh!! I have answered my own question, thanks me :) "FBxiii&...

How do I close a form without saving the record
I am trying to figure out a way to cancel or close a form without saving the record. I tried: DoCmd.Close acForm, Me.Name, acSaveNo, but a blank record is still created. I want to just be able to close the form without creating anything once I click cancel. How can I accomplish this? Thanks On Thu, 10 Jan 2008 07:51:02 -0800, Ayo <Ayo@discussions.microsoft.com> wrote: >I am trying to figure out a way to cancel or close a form without saving the >record. I tried: DoCmd.Close acForm, Me.Name, acSaveNo, but a blank record is >still created. > I want to just be able to cl...

Combo box for related records AND non-related records
Hello, Sorry if this question has been answered, but my searches have not yielded the posts. Here is what I want to do: I have a form with a combo box for City and one for State. I have two lookup tables: lkpCity cityID, City, stateID lkpState stateID, State I have the combo box for City set up, and the one for State to depend on the control for City. These are necessary because we've got a lot of spelling errors. Very often, however, the respondents whose data we are entering fail to provide a city, but list their state. If this happens, I can't get a l...

Records are not migrated, simply refused with no informations using the CRM import assistant ?
Hello everyone, I could solve some previous problems like : Once import cdf_account, records in cdf_account_ext are inserted as well and generates dup keys when inserting extensions I didn't set some mandatory fields and some informations were wrong But now I though I was able to insert my cdf in CRM but no way, and no informations still... I'm a bit surprised as few of my columns seem to be moved to CRM in the log, here is a sample ( manipulated to help reading ) of that log : 24/08/2007 - 11:34:46 -- Creating object 24/08/2007 - 11:34:48 -- Failed to migrate object: 24/08/2007...

stay connected
Can anyone tell me how to set the option to stay connected after send/receive in Outlook XP Thanks Jeff wrote: > Can anyone tell me how to set the option to stay connected after > send/receive in Outlook XP Are you using dial-up modem or broadband connection? -- Alex Yu http://mucha.us/blogs/alex/ This posting represents my own opinion, and in no way claims to represent the views of Microsoft Corporation. This posting is provided "as is" with no warranties, and confers no rights. Please do not send e-mail directly to this alias. This alias is for newsgroup purposes o...

Form stays with transparent background
Access 2007 on Vista I am using a form to act as a message box to seek the users patience while data connections are completed. The connecting process runs about 34 seconds on the current hardware. The form is opened with a DoCmd.OpenForm, but is only partially rendered and the background remains transparent. After the completion of significant later code, the form finally is fully presented, but way too late to be either beneficial or professional. How can the complete form opening be forced before program moves on to processing more code? Inserting intentional delay routines...

recording totals in another workbook
I need a macro to copy the date, location and amount from an invoice an paste it into another worksheet or workbook. The result should provide a summary of all invoice processed. Any ideas?: -- Message posted from http://www.ExcelForum.com Hi i would start with recording a macro while doing this manually. this should give you a starting point. also see: http://www.rondebruin.nl/copy5.htm -- Regards Frank Kabel Frankfurt, Germany > I need a macro to copy the date, location and amount from an invoice > and paste it into another worksheet or workbook. > The result should provide...