sendkey through VBA to field in a form

AshikHusein

Registered User.
Local time
Today, 17:40
Joined
Feb 7, 2003
Messages
147
Hello all!

I have designed this multi-user application in which two users are not supposed to ever view the same client record. It works pretty efficiently except in the mornings when all users log on almost at the same time and this challenges the logic with the result that two users sometimes view the same record. I have asked the users to enter an "X" in the notes field( which I have called Notesfield1) and if they cannot enter an "X" it would mean that somone else is also viewing that very same record.

Now I understand that a record locks (for pessimistic locking), when a record is being edited through a form (correct me if I am wrong here) and I want to program a "sendkey" type of command which will add an "X" automatically to Notesfield1 and then delete it immediately through a "sendkey" type of command. If the record is locked, the program will fall through the error routine to the next record which is not being viewed by anyone else.

The idea is that the users should not have to type an "X" and the program shld do it automatically.

Could anybody help me in with the syntax of how I could "sendkey" through Visual Basic. My book gives me very little info about "sendkey". Thanks
 
Hello AshikHusein,

I'm still learning VBA but a solution could be to use an append/update query onload to set the feild to X and another one onexit that sets it to null.

Emma
 
Thanks for your input Emma.

From my experience (and again I may not be absolutely accurate here), a record gets locked only by a manual input (like by typing something on the
keyboard). The only commnad which represents something exactly as that is the "sendkey" command.

My program actually updates a field in the table but when two users land on the same record at the same time, it does not lock the record.

But I will definately give your suggestion a try.
 

Users who are viewing this thread

Back
Top Bottom