Number pad... (or on screen keyboard) (1 Viewer)

Chrisopia

Registered User.
Local time
Today, 08:46
Joined
Jul 18, 2008
Messages
279
Basically Ive just asked for what I need, a number pad.

See eventually we're getting touch screens because the shelf for the computer is going so we only have enough room for a monitor, which is all we need.

I have done this before with a department box, you click on the box and the department pad opens up, and enters an number (department number) into the relavent box (department ID) and thus the department appears,

however this time I require to string figures together... for instance pressing 1 will not close the box off, and pressing 2 after it will not erase the 1 previously pressed... but pressing a CL key will clear the box completely.
 

bwyrwitzke

Registered User.
Local time
Today, 16:46
Joined
Nov 11, 2002
Messages
50
Basically Ive just asked for what I need, a number pad.

See eventually we're getting touch screens because the shelf for the computer is going so we only have enough room for a monitor, which is all we need.

I have done this before with a department box, you click on the box and the department pad opens up, and enters an number (department number) into the relavent box (department ID) and thus the department appears,

however this time I require to string figures together... for instance pressing 1 will not close the box off, and pressing 2 after it will not erase the 1 previously pressed... but pressing a CL key will clear the box completely.


Anyluck on this? I need to do something similar using a touch screen. Thanks.

Bruce
 

missinglinq

AWF VIP
Local time
Today, 11:46
Joined
Jun 20, 2003
Messages
6,423
You don't say whether you're planning to use this "keypad" to enter data in one field or multiple fields.

One field is fairly easy, with the buttons being repeated for digits 3-0

Code:
Private Sub Key1_Click()
If IsNull(Me.FieldA) Then
  Me.FieldA = "1"
Else
  Me.FieldA = Me.FieldA & "1"
End If
End Sub

Private Sub Key2_Click()
If IsNull(Me.FieldA) Then
  Me.FieldA = "2"
Else
  Me.FieldA = Me.FieldA & "2"
End If
End Sub

Private Sub CL_Click()
  Me.FieldA = Null
End Sub

Doing it for multiple fields is a little harder but can be done

Code:
Private Sub Form_Current()
  Me.AnyTextBox.SetFocus
End Sub

Private Sub CL_Click()
  Screen.PreviousControl = Null
  Screen.PreviousControl.SetFocus
End Sub

Private Sub Key1_Click()
If IsNull(Screen.PreviousControl) Then
  Screen.PreviousControl = "1"
  Screen.PreviousControl.SetFocus
Else
  Screen.PreviousControl = Screen.PreviousControl & "1"
  Screen.PreviousControl.SetFocus
End If
End Sub

Private Sub Key2_Click()
If IsNull(Screen.PreviousControl) Then
  Screen.PreviousControl = "2"
  Screen.PreviousControl.SetFocus
Else
  Screen.PreviousControl = Screen.PreviousControl & "2"
  Screen.PreviousControl.SetFocus
End If
End Sub
 

tetrapak

New member
Local time
Today, 16:46
Joined
Aug 26, 2009
Messages
2
Doing it for multiple fields is a little harder but can be done
Code:
Private Sub Form_Current()
  Me.AnyTextBox.SetFocus
End Sub

Private Sub CL_Click()
  Screen.PreviousControl = Null
  Screen.PreviousControl.SetFocus
End Sub

Private Sub Key1_Click()
If IsNull(Screen.PreviousControl) Then
  Screen.PreviousControl = "1"
  Screen.PreviousControl.SetFocus
Else
  Screen.PreviousControl = Screen.PreviousControl & "1"
  Screen.PreviousControl.SetFocus
End If
End Sub

Hi Linq,

Sorry again for this private message. Thanks for the tip regarding the coursor. It works now.

In case of my problem with decimal mark let me provide more information about my application. Please look at the picture.



Access form is connected to linked table from SQL database thru ODBC.

The field "Nr pracownika" has "int" type in SQL table and I do not need decimal here.

The field "Wartość zamówienia" has "float" type in SQL table and this will be used for currency amount. Here I need decimal.

I will not make any mathematical operations on this field. It's just a place to collect some value which will be saved into SQL table.

The sequence is: fill in the first field, fill in the second field and press "Add to database" button.

What should I do in that case to have the decimal mark?


Thanks in advance
Brgds
Mariusz
 

missinglinq

AWF VIP
Local time
Today, 11:46
Joined
Jun 20, 2003
Messages
6,423
In order for the comma you're using as a decimal mark to be used with this field, the field's datatype has to be changed from Float to Text. If the field is only being used for display and you will not be using it for mathematical operations, it really doesn't need to be defined as a float, does it?
 

tetrapak

New member
Local time
Today, 16:46
Joined
Aug 26, 2009
Messages
2
In order for the comma you're using as a decimal mark to be used with this field, the field's datatype has to be changed from Float to Text. If the field is only being used for display and you will not be using it for mathematical operations, it really doesn't need to be defined as a float, does it?

Yes, you are right. Now my Access form works with field type "varchar" in SQL table.

This Access form does not make any mathematical operations but....

Now I have a varchar values in table (with 2 decimal):
123,34
34,45
23,11

I would like to create a simple SELECT which will sum these values.
Code:
SELECT
SUM(Order_Value) AS Sum_Order
FROM dbo.Canteen
SUM is working in Access form but it doesn't in SQL SELECT. Data type varchar needs to be converted to some other format which will allow for mathematical operations.
How to do it?
 

itsabayomi

Registered User.
Local time
Today, 08:46
Joined
Dec 16, 2019
Messages
12
You don't say whether you're planning to use this "keypad" to enter data in one field or multiple fields.

One field is fairly easy, with the buttons being repeated for digits 3-0

Code:
Private Sub Key1_Click()
If IsNull(Me.FieldA) Then
  Me.FieldA = "1"
Else
  Me.FieldA = Me.FieldA & "1"
End If
End Sub

Private Sub Key2_Click()
If IsNull(Me.FieldA) Then
  Me.FieldA = "2"
Else
  Me.FieldA = Me.FieldA & "2"
End If
End Sub

Private Sub CL_Click()
  Me.FieldA = Null
End Sub

Doing it for multiple fields is a little harder but can be done

Code:
Private Sub Form_Current()
  Me.AnyTextBox.SetFocus
End Sub

Private Sub CL_Click()
  Screen.PreviousControl = Null
  Screen.PreviousControl.SetFocus
End Sub

Private Sub Key1_Click()
If IsNull(Screen.PreviousControl) Then
  Screen.PreviousControl = "1"
  Screen.PreviousControl.SetFocus
Else
  Screen.PreviousControl = Screen.PreviousControl & "1"
  Screen.PreviousControl.SetFocus
End If
End Sub

Private Sub Key2_Click()
If IsNull(Screen.PreviousControl) Then
  Screen.PreviousControl = "2"
  Screen.PreviousControl.SetFocus
Else
  Screen.PreviousControl = Screen.PreviousControl & "2"
  Screen.PreviousControl.SetFocus
End If
End Sub


Hello house, the above for multiple fields works on main form but not subform. Please how can I use it to enter number to a subform field as well.

At the subform, I have fields SalesID, Item, Quantity,... I only need to update number in Quantity field. I just started with vba. Thank you
 

Users who are viewing this thread

Top Bottom