If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Open Continuous form with a few lines showing
Hi
I have successfully implemented a continuous form to open at a new line with RunCommand acCmdRecordsGoToNew in the Load Event However, you have to manually scroll a little to see a few of the previous records. It would be nice to see up to 5 of these previous lines on Opening the form Is there a way to modify this code to do that? Thanks Neil |
#2
|
|||
|
|||
Open Continuous form with a few lines showing
Change the form's underlying record source to a Top 5 query.
In a query's design view, right click in a blank area, and choose properties. Set the Top Values to 5, then adjust your criteria and order by clause to return the records you want. Use that query as your form's record source. -- Arvin Meyer, MCP, MVP http://www.datastrat.com http://www.accessmvp.com http://www.mvps.org/access "neil40" wrote in message ... Hi I have successfully implemented a continuous form to open at a new line with RunCommand acCmdRecordsGoToNew in the Load Event However, you have to manually scroll a little to see a few of the previous records. It would be nice to see up to 5 of these previous lines on Opening the form Is there a way to modify this code to do that? Thanks Neil |
#3
|
|||
|
|||
Open Continuous form with a few lines showing
On 5 May, 02:16, "Arvin Meyer [MVP]" wrote:
Change the form's underlying record source to a Top 5 query. In a query's design view, right click in a blank area, and choose properties. Set the Top Values to 5, then adjust your criteria and order by clause to return the records you want. Use that query as your form's record source. -- Arvin Meyer, MCP, MVPhttp://www.datastrat.comhttp://www.accessmvp.comhttp://www.mvps.org/access "neil40" wrote in message ... Hi I have successfully implemented a continuous form to open at a new line with RunCommand acCmdRecordsGoToNew in the Load Event However, you have to manually scroll a little to see a few of the previous records. It would be nice to see up to 5 of these previous lines on Opening the form Is there a way to modify this code to do that? Thanks Neil- Hide quoted text - - Show quoted text - I'll give it a try Arvin, but not quite what I want. I like the whole set of data being available to me in the continuous form, and wanted the 'new' line to appear with a few 'old' lines ideally. I can certainly scroll if necessary, to check where I left off, but if it could be 'automatic' that would be better. I presuming that your solution only returns the lst 5 records? Neil |
#4
|
|||
|
|||
Open Continuous form with a few lines showing
This should do the job
Private Sub Form_Load() DoCmd.RunCommand acCmdRecordsGoToNew For i = 1 To 5 DoCmd.GoToRecord , , acPrevious Next i End Sub -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201005/1 |
#5
|
|||
|
|||
Open Continuous form with a few lines showing
As an afterthought, you might want to check that you have at least 5 record
before executing the For i = 1 To 5 DoCmd.GoToRecord , , acPrevious Next i -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201005/1 |
#6
|
|||
|
|||
Open Continuous form with a few lines showing
On Wed, 05 May 2010 12:25:53 GMT, "Linq Adams via AccessMonster.com"
u28780@uwe wrote: As an afterthought, you might want to check that you have at least 5 record before executing the For i = 1 To 5 DoCmd.GoToRecord , , acPrevious Next i Or just trap and ignore the "you cannot go to this record" error. -- John W. Vinson [MVP] |
#7
|
|||
|
|||
Open Continuous form with a few lines showing
On May 5, 1:22*pm, "Linq Adams via AccessMonster.com" u28780@uwe
wrote: This should do the job Private Sub Form_Load() * DoCmd.RunCommand acCmdRecordsGoToNew *For i = 1 To 5 * *DoCmd.GoToRecord , , acPrevious *Next i End Sub -- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.comhttp://www.accessmonster.com/Uwe/Forums.aspx/access-forms/201005/1 Linq Thanks for this, the first line returned an error so I took out the DoCmd and now it works. Furthermore, I added another loop to take the cursor back down to the input line So it now reads: Private Sub Form_Load() RunCommand acCmdRecordsGoToNew For i = 1 To 5 DoCmd.GoToRecord , , acPrevious Next i For j = 1 To 5 DoCmd.GoToRecord , , acNext Next j End Sub Perfect! Neil |
#8
|
|||
|
|||
Open Continuous form with a few lines showing
Glad you got it working!
-- There's ALWAYS more than one way to skin a cat! Answers/posts based on Access 2000/2003 Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/For...forms/201005/1 |
Thread Tools | |
Display Modes | |
|
|