Using Keycodes

crowegreg

Registered User.
Local time
Today, 13:56
Joined
Feb 28, 2011
Messages
108
Here is my code within the keydown event in a textbox named GUTS

If KeyCode = vbKeyReturn Then
KeyCode = 0
ElseIf KeyCode = "9" Then
If IsNull(Me.GUTS) Then
MsgBox "You must enter something within this field"
KeyCode = 0
End If
End If

After the user presses tab, without entering any data in this field, the message box is displayed. So this is working. But if they enter any data, hoping to move to the next field, the message reappears. Why?
 
Try this.

If IsNull(Me.GUTS.Text) Then
 
No, it advances to the next field.
 
ok. Removed the double quotes. That had no affect on my original problem.
 
Can you put that form into a clean Database and post it here.

Use 2003 NOT 2007/10. I am not rich enough to afford the latest.
 
Your missing out on some cool stuff you can do with a custom ribbon Mr. Rain!
 
In Access 2003, I can't get the form to open properly. I can't figure out which reference I'm missing. Maybe you'll be able to tell. When the form opens, all that is visible are the control buttons: edit record, update box, add box, and close.
 

Attachments

You can't see much because your code has turned off the Visible Property.

Your original problem is more involved than one would initially think.

Please explain the objective of what you are trying to achieve and most importantly Why.
 
Here is a working DB.
I only want the tab key to be able to move to the next field, and I need to make sure the field has data within it.
 

Attachments

And will they be using Access 97 with their keyboard only setup? :D
 
>>The customer wants to use the keyboard.<<

>>And will they be using Access 97 with their keyboard only setup?<<

If the customer says they want to use the keyboard it does not mean they only want to use the keyboard. Nor does it mean they only want to use it in Access97 which, by the very nature of the download version in post #8, is a certainty.

This sort of thing is far too complex to write without knowing the exact requirements.

The download provided in post #8 will not run in Access 2003, as is, so some assumptions must be made. Since those assumptions must be made by looking at the code, and not by how it works, then the assumptions may be wrong.

Attached is an Access2003 cutdown of the attachment in post #8. It requires no references and has everything removed other than that which is required to function across the three fields (Controls) which, I assume, are concerned. The code should be correct but the assumptions could be wrong.

It has nothing to do with pretty little ribbons which might prove to strangle us with their apparent beauty and need.

Please test the attachment for functionality as compared with the attachment in post #8 and what may have been required. The functionality in post #8 appears to be incorrect but I have tried to duplicate it verbatim even if it is incorrect. The aim was to reduce it to a minimum so that it may be tested without external requirements.

Chris.
 

Attachments

Last edited:
Chriso

The reference to 97 is Speakers idea of a Joke after I made the statement that I would prefer 97 to 2007.
 

Users who are viewing this thread

Back
Top Bottom