Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

how small calculator on Access-Form

Status
Not open for further replies.

77aaaa77

Vendor
Dec 7, 2004
1
0
0
NL

Hi,

Please help me my " all-better-one"
I have tried to write code in VB to make a small calculator on the Access-Form. The problem is it does not return the decimal value like ( 2.56 + 3.45= 6.???? ).
Here are the code i wrote.

***
Dim Getal1 As Long
Dim Getal2 As Long
Dim Getal3 As Long
Dim Komaf As Long
Dim hulp As String

Private Sub Tekst1_LostFocus()
TelOp
'Komaf = 1
End Sub
Private Sub Tekst2_LostFocus()
TelOp
End Sub

Public Function TelOp()
'Dim total As Single
'total = Val(Tekst1.Text) + Val(Tekst2.Text)

On Error GoTo FOUT
Tekst1.SetFocus
Getal1 = Val(Tekst1.Text)

Tekst2.SetFocus
Getal2 = Val(Tekst2.Text)

Getal3 = (Getal1 + Getal2)

Getal3 = Round(Getal3, 6)

Tekst3.SetFocus
Tekst3.Locked = False
'MsgBox ("wat ")
Tekst3.Text = Getal3


Tekst3.Locked = True
'If Komaf = 1 Then
' Tekst2.SetFocus
' Else: Tekst2.SetFocus
'End If
FOUT:
End Function

****
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top