-
1
- #1
I have a form that I want the user to be able to enter data into textboxes and use the ENTER key rather than the TAB key. This works fine searching for KeyAscii 13 on all my forms execpt ones dealing with a database. The database will not Update. Here is my code that doesn't work. It works fine if I put the Update in a command button click event. I even tried to use the click event in my sub, but it didn't work either. Hopefully someone can help, this makes no sense to me.
BTW The textboxes DataSource and DataField are set to the database via code.
Private Sub Text1_KeyPress(Index as Integer, KeyAscii as Integer)
Select Case Index
Case 0
Case 1 'This does NOT work
If KeyAscii = 13 then
KeyAscii = 0
rsAccess.Update 'rsAcces is the recordset
'Command1_Click 'goes to the click sub, but won't Update
MsgBox "Updated"
Exit Sub
End If
Case 2
Case 3
End Select
End Sub
Private Sub Command1_Click()
rsAccess.Update 'this works fine when the
End Sub 'command button is clicked
I really need to be able to update and use the ENTER key, as all my other forms use this method.
Thanks in advance for any help
Catrina
[sig][/sig]
BTW The textboxes DataSource and DataField are set to the database via code.
Private Sub Text1_KeyPress(Index as Integer, KeyAscii as Integer)
Select Case Index
Case 0
Case 1 'This does NOT work
If KeyAscii = 13 then
KeyAscii = 0
rsAccess.Update 'rsAcces is the recordset
'Command1_Click 'goes to the click sub, but won't Update
MsgBox "Updated"
Exit Sub
End If
Case 2
Case 3
End Select
End Sub
Private Sub Command1_Click()
rsAccess.Update 'this works fine when the
End Sub 'command button is clicked
I really need to be able to update and use the ENTER key, as all my other forms use this method.
Thanks in advance for any help
Catrina
[sig][/sig]