Solved

moving in DBGrid

Posted on 2002-03-06
1
156 Views
Last Modified: 2008-02-01
Hi VB Experts,

Again with DBGrid ...

please, i need the code which can do the following:
when I click "Enter" in the active cell , the pointer moves down (let the active cell becomes the next row in the same column) exactly like "MS EXCEL".  BUT when i reach the last Row , let the pointer moves till the first row in the same column.

Thank you so much
Toni2002
0
Comment
Question by:toni2002
1 Comment
 
LVL 32

Accepted Solution

by:
bhess1 earned 50 total points
ID: 6845465
In the DBGrid_Keypress event:

If KeyAscii = 13 Then  ' Enter
   KeyAscii = 0
   On Error Goto AtBottom
   DBGrid.Row = DBGrid.Row + 1
   On Error Goto 0
End If

ExitKeypress:
Exit Sub

AtBottom:
DBGrid.Row = 0
DBGrid.FirstRow = 0
Resume ExitKeypress

End Sub
0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
DIR issue 7 47
Excel - Save a copy of work book 13 79
vb6 connector to mongodb 2 26
clicking a shape in a frame array vb6 3 0
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
When designing a form there are several BorderStyles to choose from, all of which can be classified as either 'Fixed' or 'Sizable' and I'd guess that 'Fixed Single' or one of the other fixed types is the most popular choice. I assume it's the most p…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now