Hey guys,
My app is using an Access DB with an ADODC control and some text boxes that connect to the DB and through them I can see the data and modify it.
I also use the KeyPreview=True in 'Form_Load', in order to use the F keys to do some functions and to move through the entries in the DB.
The thing is, when I'm using the F3 key, for-instance, to cancel the changes that were made to the DB by the Text Boxes using the command -
<<--CODE->>
AdoDB.Recordset.CancelUpdate 'To cancel the Changes made through the TxtBoxes
AdoDB.Recordset.AbsolutePosition=AdoDB.RecordSet.AbsolutePosition 'To Refresh the Textboxes.
<<-END OF CODE->>
The change is saved to the DB itself, instead of being canceled. When I run the cancel command by clicking the 'Cancel Changes' button with the mouse everything is fine.
I also did a little research and found out that the Recordset will only save the changes to the DB if I run the command by keyboard, as I've said, AND only if the cancel command is being run from 'Form_KeyUp' or 'Form_KeyDown'. If I run the cancel command with the keyboard through the 'Form_KeyPress' everything is alright. I would have use the 'Form_KeyPress' procedure, but I can't use the F Keys with it.
Do you have any Ideas of how to cancel the changes through the 'Form_KeyUp' or 'Form_KeyDown' procedures, or how to use the F keys through the 'Form_KeyPress' procedure?
Thank you very very much,
Dave.
My app is using an Access DB with an ADODC control and some text boxes that connect to the DB and through them I can see the data and modify it.
I also use the KeyPreview=True in 'Form_Load', in order to use the F keys to do some functions and to move through the entries in the DB.
The thing is, when I'm using the F3 key, for-instance, to cancel the changes that were made to the DB by the Text Boxes using the command -
<<--CODE->>
AdoDB.Recordset.CancelUpdate 'To cancel the Changes made through the TxtBoxes
AdoDB.Recordset.AbsolutePosition=AdoDB.RecordSet.AbsolutePosition 'To Refresh the Textboxes.
<<-END OF CODE->>
The change is saved to the DB itself, instead of being canceled. When I run the cancel command by clicking the 'Cancel Changes' button with the mouse everything is fine.
I also did a little research and found out that the Recordset will only save the changes to the DB if I run the command by keyboard, as I've said, AND only if the cancel command is being run from 'Form_KeyUp' or 'Form_KeyDown'. If I run the cancel command with the keyboard through the 'Form_KeyPress' everything is alright. I would have use the 'Form_KeyPress' procedure, but I can't use the F Keys with it.
Do you have any Ideas of how to cancel the changes through the 'Form_KeyUp' or 'Form_KeyDown' procedures, or how to use the F keys through the 'Form_KeyPress' procedure?
Thank you very very much,
Dave.