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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Question regarding "next record" control button on a form

Status
Not open for further replies.

Paul7905

MIS
Jun 29, 2000
205
US
Have a form which displays one record at a time on a form. I have control buttons on the form which allow the user to go to navigate to the next and previous records as well as a search button but the user would like to be able to "scroll" through the records as well.

It occurred to me that I might be able to accomplish this by putting dowhile loop code in the On Mouse Down event for the "next" and "previous" record control buttons that would loop through the gotorecord command until the user released the mouse button.

I have tried several things attempting to ascertain the status of the mouse button and everything fails (I don't seem to be able to tell whether the mouse button on the control is depressed or not. (i even turned on the auto repeat property to "yes" and this did not work either)

I figured if I put a loop in the OnMouseDown event and then could determine when the OnMouseUp event was triggered I could accomplish this :

Do While Me.NextRecord.OnMouseUp = False
DoCmd.GoToRecord , , acNext
Do Events
Loop

Does anyone have any suggestions as to how I might get something like this to work?

Thanks
Paul
 
Use the navigation buttons on the form instead of creating your own. You can turn the navigation buttons on (if they are not already) by going to the properties of the form and setting the 'navigations buttons' property to yes underneath the format tab. You will then have buttons at the lower left corner of the form. If you depress and hold the next or previous button, it will scroll quickly through the records.

Mike Rohde
rohdem@marshallengines.com
 
Mike, yes, thanks, we had discussed this and if this is the only way to do it we'll settle but would have preferred to use a larger command button placed strategically on the form so as to reduce mouse movements ~ (I wonder if there is any way to see the code behind the forms navigation button ?)
 
Paul7905: There is another method but it is not too pretty. You could create a subform, and it that subform display the results of a query (or perhaps create a recordset) of all the records the user wants to see. This way the user would be able to use the scroll bar on the right side to move through the entire recordset. I'm not going into details cause they'd be lengthy, but you get the general idea. It may not be elegant but it works.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top