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

Is it possible to cursor up and down a column... 3

Status
Not open for further replies.

jlitondo

MIS
Jun 27, 2000
175
US
...in a continous form using the keyboard arrow keys just like in a datasheet? Currently my users are having to click on each row of the field they are editing and there are tens of them at a time. Thanks.

 
Paging up and down would not work in this scenario, the users are currently using the scroll mouse but it is a slightly cumbersome solution since their hands have to leave the keyboard alot.
This is the way its set up, there is rows 1-100... and 12 columns for Jan to Dec. For each of these rows, they need to fill data for just one month(column) at a time. So say they place the cursor in the jan column(since info for feb etc is not available yet), they need to populate this column on every row, it would be nice if they could use the arrow up and down keys to go from one row to the next without leaving this column and without their hands leaving the keyboard.
I just wondered whether I missed a feature that could be turned on for continous forms to allow for this or whether this could be achieved through code.

 
Hi jlitondo,

Paste this into your form's module:

Private Function UpOrDown(intKeyCode As Integer)
On Error Resume Next
If intKeyCode = 40 Then
DoCmd.GoToRecord , , acNext
ElseIf intKeyCode = 38 Then
DoCmd.GoToRecord , , acPrevious
End If
End Function

Paste this into the KeyDown event of ALL the text boxes that you want this to work on:

UpOrDown (KeyCode)

Allthe best

Bill

 
Tsk tsk, Bill. Magic Numbers are always bad!

Instead of "40" in the above code, use "vbKeyDown".
Instead of "38" in the above code, use "vbKeyUp".

--Shaun Merrill
 
SMerrill,

Why are they bad. Who says so? 40 is next, 38 is previous.

Why waste everyone's time posting stuff like this. Are you just envious that you didn't think of how to solve jlitondo's problem.

Bill
 
 
...in fact, a Yahoo websearch on "Magic Numbers" Programming yields 6,430 results. I only showed six of them.

--Shaun Merrill
 
Hi SMerrill,

I see where you're coming from now. I will in future use the vbKeyDown or similar when referring to Keycodes.

Please excuse me, I'm an out of work unhappy person at the moment.

If anyone needs a reasonably good Access or VB programmer in the "London" area of England, please contact me at billpower@cwcom.net

Bill

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top