Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Events triggered when move to new record

Status
Not open for further replies.

Rory

Technical User
May 30, 2000
2
CA
I have a datasheet in a form for which I maintain calculated controls to sum the rows and columns.&nbsp;&nbsp;I want to be able to update the sums whenever a cell in the datasheet is changed.&nbsp;&nbsp;Everything works fine when you change a cell and then move to a new record in the datasheet, as the record is updated and the form automatically updates all the calculated controls.<br><br>However, I want the controls to update when I update one field within a record and move to another field in the same record.&nbsp;&nbsp;I have tried Me.Requery and Me.Refresh, which work, but cause the entire datasheet to be repainted, which is very distracting.&nbsp;&nbsp;This does not happen when I move to a new record.<br><br>So, what I want to do, is to replicate whatever access does when the cursor leaves the current record.<br><br>Can anyone help me on this?&nbsp;&nbsp;Thanks in advance.<br><br>Rory<br><br>
 
<br>&quot;...when Access leaves the current record&quot; (and moves to the next record), use 'Form_Current'. <br><br><br>Have fun. <p>Amiel<br><a href=mailto:amielzz@netscape.net>amielzz@netscape.net</a><br><a href= > </a><br>
 
Thanks Amiel<br><br>That works when you move between records, but not to move between fields in the same record.&nbsp;&nbsp;However, I did figure out one solution.<br><br>As it turns out, Access is saving, not refreshing the record, and as a result, does not repaint the entire datasheet when you move between records, so what I wanted to do was initiate a record save when moving between fields.&nbsp;&nbsp;There does not appear to be a method to do this so I used SendKeys &quot;+{ENTER}&quot; in a macro which I triggered in the LostFocus event for each field.&nbsp;&nbsp;Cumbersome, but it works.<br><br>Once again, thanks for your response.<br><br>Cheers<br>
 
Rory,<br><br>Here is a less cumbersome method that was discussed yesterday.<br><br><br>Try inserting one line of code behind the &quot;On Lost Focus&quot; for each field. Use the code builder behind the property and add:<br><br>DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, , acMenuVer70<br><br><br>Better yet, use extreme1's newer and shorter command that will achieve the same result:<br><br>DoCmd.RunCommand acCmdSaveRecord<br>&nbsp;<br>Regards,<br><br>3rdRail<br>&nbsp;
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top