Disable field using keyboard???

Crystallew

Registered User.
Local time
Today, 07:19
Joined
Jun 21, 2007
Messages
13
Hi (",o)

Does anyone knows whether can I force a specific FIELD in a FORM so that user is not able to input values using keyboard but yet using a barcode scanner to input values only?

Your help will be greatly appreciated!
 
Can you get the bar code scanner to work? If so, in the text box properties set
Enabled - No
Locked - Yes

Dave
 
This code will prevent any input from the keyboard but should allow input from the scanner:
Code:
Private Sub YourFieldName_KeyDown(KeyCode As Integer, Shift As Integer)
  KeyCode = 0
End Sub

I think you could probably also simply set the textbox's Locked Property to YES as well, but not sure about that.
 
Hi Dave,

I've tried changing from the text properties for a specific field from

Enabled: Yes to No
Locked: No to Yes

however the cursor is not field and upon scanned, nothing appear on the field.
 
Hi missingling,

May I know where should I placed the code? Just create a module and place the code there? or should i insert the module into somewhere? Sorry as i'm not familiar with codes...
 
Go into Design View for your form
Right click on your text box
Click on Properties
Click on Events tab
Scroll down to On Key Down
Click in the white box
Click on the ellipsis (...)
DoubleClick on Code Builder

You're now in the form's module (the code behind the form)
You should be at or near a sub tha looks like this:

Private Sub YourFieldName_KeyDown(KeyCode As Integer, Shift As Integer)

End Sub

where YourFieldName is the actual name of your text box

Enter the line KeyCode = 0

so that it now looks like this

Code:
Private Sub YourFieldName_KeyDown(KeyCode As Integer, Shift As Integer)
  KeyCode = 0
End Sub

Now click on the red Access Key icon, usually in the left upper part of the menu bar. This will take you back into Design View. Exit Design View and save the changes when prompted.

Now the user can type all day and not enter anything into the text box, but the scanner should be able to work just fine, assuming you have the scanner set up correctly to scan data into the text box .
 
Hi,

If a control is Disable, your Barcode scanner will not be able to input data.
Just set the control to "Locked = Yes". Leave the Enable = Yes.

Hi Dave,
I've tried changing from the text properties for a specific field from
Enabled: Yes to No
Locked: No to Yes
however the cursor is not field and upon scanned, nothing appear on the field.
 
Hi,

If a control is Disable, your Barcode scanner will not be able to input data.
Just set the control to "Locked = Yes". Leave the Enable = Yes.

I believe the scanner essentially becomes a keyboard and therefore if you disable, or lock, the field it won't be able to enter anything. Therefore, Missinglinq's suggestion should be the optimal fix.
 
Hi missingling,

Thanks for the detail guiding.. I've tried using ur guidelines and now the cursor appeared on the field and is unable to use keyboard to key any value. However, when i used the scanner trying to input value into the field, no value appear on the field.
 
Did the scanner come with a driver? I don't think it would be natively supported and would need one to be able to use. What brand and model is it?
 
Hi Bob Larson,

The scanner is a product of Unitech MS330-1 Barcode Scanner, basically i need not perform any installation. I simply plug and use from the USB port.
 
Have you set it up using the Scanner Configuration Manager software?
 
Hi Bob,

Hmmm…That’s ironic, as you said “the scanner essentially becomes a keyboard”. Than missinglinq’s code will set the KeyCode = 0. That will defeat the use of a scanner.

I have done this before by locking the controls, as I recalled, it works. I don’t have a scanner right now to check. Perhaps, I had a code in the form to control the user input.

I believe the scanner essentially becomes a keyboard and therefore if you disable, or lock, the field it won't be able to enter anything. Therefore, Missinglinq's suggestion should be the optimal fix.
 
Hi Bob,

Hmmm…That’s ironic, as you said “the scanner essentially becomes a keyboard”. Than missinglinq’s code will set the KeyCode = 0. That will defeat the use of a scanner.

I have done this before by locking the controls, as I recalled, it works. I don’t have a scanner right now to check. Perhaps, I had a code in the form to control the user input.

I think the first order of operation should be to get the scanner working and then figure out how to avoid keyboard entry instead of scanner entry. So, your point may be valid about the keycode being set to 0 but I don't see how you can lock the field and yet have it go in as well because if you notice, if you lock the field you cannot type in the field, and if your logic about the keycode holds true then it would then be the same as typing in a keyboard.
 
Hi unclejoe,

I've did tried Enabled: Yes and Locked: Yes, but still no scanned value is reflected in the field, however, if i leave it Enabled: Yes & Locked: No, scanned value is reflected but this means user can also input from keyboard.
 
Hi Bob,

Nope.. when i got the scanner from my IT personnel, i simply just plug into any USB port and it just able to scan.
 
Hi Bob,

Nope.. When i got it from the IT personnel, I simply just plug and use on any USB port.
 
Hi,

I hope you did not used missinglinq's code when you set both to "Yes"?

Hi unclejoe,
I've did tried Enabled: Yes and Locked: Yes, but still no scanned value is reflected in the field, however, if i leave it Enabled: Yes & Locked: No, scanned value is reflected but this means user can also input from keyboard.
 
Hi Bob,

Yes, as i reply earlier, I did tried missingling sugguestion but still no value is reflected.
 

Users who are viewing this thread

Back
Top Bottom