Please could someone help with this problem. I have a datagrid that works perfectly back to a MS database. I have written the keycode functions for up, down, left and right keys in the datagrid. A error occurs when you use the up arrow key to the first record in the database. If you are on the first record and press the up key then you get the data access error as there is obviously no record. How can I stop the keycode from firing when it reaches the first record.
VB Code:
If KeyCode = vbKeyRight Then
KeyCode = vbKeyReturn And vbKeyTab
End If
If KeyCode = vbKeyDown Then
Adodc2.Recordse t.MoveNext
End If
If KeyCode = vbKeyDown Then
KeyCode = vbKeyTab And vbKeyLeft
End If
If KeyCode = vbKeyUp Then
Adodc2.Recordse t.MovePrevious
End If
If KeyCode = vbKeyUp Then
KeyCode = vbKeyTab And vbKeyLeft
End If
If KeyCode = vbKeyDelete Then
KeyCode = vbKeyBack And vbKeyReturn
End If
Thanks
Werner
VB Code:
If KeyCode = vbKeyRight Then
KeyCode = vbKeyReturn And vbKeyTab
End If
If KeyCode = vbKeyDown Then
Adodc2.Recordse t.MoveNext
End If
If KeyCode = vbKeyDown Then
KeyCode = vbKeyTab And vbKeyLeft
End If
If KeyCode = vbKeyUp Then
Adodc2.Recordse t.MovePrevious
End If
If KeyCode = vbKeyUp Then
KeyCode = vbKeyTab And vbKeyLeft
End If
If KeyCode = vbKeyDelete Then
KeyCode = vbKeyBack And vbKeyReturn
End If
Thanks
Werner
Comment