Private Sub txt_Change()
FraLmt Me!txt, 2 ←テキストの内容を小数点以下2桁で制限する
End Sub
Sub FraLmt(d As TextBox, fd As Byte)
Dim x
If IsNull(d.Text) Then Exit Sub
If 0 = Len(d.Text) Then Exit Sub
If Not IsNumeric(d.Text) Then Exit Sub
x = d.Text * 10 ^ fd
If x - Fix(x) <> 0 Then
d.Text = Fix(x) / (10 ^ fd)
d.SelStart = Len(x)
End If
End Sub