We use a form to log water samples in the lab. Each sample needs a different number of bottles. There is a text box in the form where we enter the number of labels needed for the current sample. We use the tests required for the sample to calculate the value for the text box. Sometimes bottles are broken in shipment and we need 1 or more fewer labels for the sample. Sometimes we receive an extra bottle for a sample and we need more than the calculated number of labels.
There are two keys we never use in the form.
OK. This I what we want to do:
From any field, anywhere in the form, we want to use the Ctrl key to increment the value in the number of labels text box by one.
From any field, anywhere in the form, we want to use the Alt key to decrease the value in the number of labels text box by one.
The code below only works when the specific text box is selected.
Private Sub txtLabID2_KeyPress(ByVal KeyAscii As MSForms.ReturnInteger)
If KeyAscii = 43 Then
txtLabID2.Text = txtLabID1 + 1
SendKeys "{BKSP}"
End If
End Sub
We would like to "program" a key for the form that works anywhere within the form.
As always, thanks for any help.
Bookmarks