[event added on Key press : Private Sub txt_hours_KeyPress(KeyAscii As Integer) ' Added as users are allowed to enter more than one decimal value, ' this code helps to limit to 1 decimal If KeyAscii < 32 Then ' let it go, it is a control char like backspace Exit Sub End If If InStr("0123456789.", Chr$(KeyAscii)) > 0 Then If InStr(txt_hours.Text, ".") > 0 Then If Chr$(KeyAscii) = "." Then ' do not allow more than one decimal point KeyAscii = 0 Else If Len(Mid$(txt_hours.Text, InStr(txt_hours.Text, ".") + 1)) >= 1 Then ' do not allow more than 1 digit past decimal point KeyAscii = 0 End If End If End If Else KeyAscii = 0 End If ]
This will work but not properly working on the production DB, Things to know is Production DB is ms access 2003 and my ms access is 2010. will that be my issue.
Also would like to know any work around other than this route like how can i write a code in Key UP event
Need a urgent reply thanks again for your time
This post has been edited by modi123_1: 30 January 2012 - 10:08 AM
Reason for edit:: please use code tags