Hi,
Check this:
'CHECK IF TEXT ENTERED AS KILOMETERS IS NUMERIC AND EMPTY THE MILES TEXT BOX
Private Sub txtKm_LostFocus()
If Me.txtKm <> "" Then
If IsNumeric(Me.txtKm) Then
Me.txtMile = ""
Else
Me.txtKm.SetFocus
MsgBox "Please enter a valid numeric value"
End If
End If
End Sub
'CHECK IF TEXT ENTERED AS MILES IS NUMERIC AND EMPTY THE KILOMETERS TEXT BOX
Private Sub txtMile_LostFocus()
If Me.txtMile <> "" Then
If IsNumeric(Me.txtMile) Then
Me.txtKm = ""
Else
Me.txtMile.SetFocus
MsgBox "Please enter a valid numeric value"
End If
End If
End Sub
'CONVERT THE NON EMPTY TEXT BOX
Private Sub cmdConv_Click()
If Me.txtKm <> "" Then
Me.txtMile = Me.txtKm / 1.60934
Exit Sub
End If
If Me.txtMile <> "" Then
Me.txtKm = Me.txtMile * 1.60934
Exit Sub
End If
End Sub
Hope this works for you.
Enter your message below
Sign in or Join us (it's free).