AKMonkeyboy
IS-IT--Management
I've got an insert statement that puts user comments into a field when they press say CTRL-0 - the problem is I can only get the data to append to the current data.
I modified the code to determine the cursor position and insert at that point, but this only works on data that has been committed to the database. Any thoughts on how to insert text into a field at the cursor position when the data is not committed?
Here's what I've got to this point:
Give a man a fish, and you feed him for a day.
Teach a man to fish, and you feed
him for life.
Send a man to Tek-Tips and the poor sap can find out how to fish on his own, and learn more by doing it.
I modified the code to determine the cursor position and insert at that point, but this only works on data that has been committed to the database. Any thoughts on how to insert text into a field at the cursor position when the data is not committed?
Here's what I've got to this point:
Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer)
On Error GoTo Err_Form_KeyDown
Dim skc: skc = Chr(KeyCode)
Select Case Shift
Case 2 'CTRL is down
Select Case skc
Case "0"
If IsNull(Me.ActiveControl) = True Then
Me.ActiveControl = DLookup("[Comment]", "[TblDefaultComments]", "[ID]=" & 0)
Else
Me.ActiveControl.SelText = DLookup("[Comment]", "[TblDefaultComments]", "[ID]=0")
End If
End Select
End Select
Exit_Form_KeyDown:
Exit Sub
Err_Form_KeyDown:
MsgBox Err.Description
Resume Exit_Form_KeyDown
End Sub
Give a man a fish, and you feed him for a day.
Teach a man to fish, and you feed
him for life.
Send a man to Tek-Tips and the poor sap can find out how to fish on his own, and learn more by doing it.