Hi,
I am working on customer care application and need to generate 3 code for asking review about service, I try to below code and generate it but every time I get same result, might be some where I doing wrong....please help me to rectify or you have any other way then plz plz guide me on it.
warmly welcome to valuable suggestion and correction
(Note: I am not a professional, but just keep focusing on my application work well by help of genius like you, so please bare with me if code found childes...
Currently Using code make easy explainable :
'Generate 4 Digit Random No between 1001 to 9000
Private Sub Command4_Click()
Dim GenerateCodeCheck As Boolean
GenerateCodeCheck = DLookup("generatecode", "ConfigT", "ConfigID = 1")
If GenerateCodeCheck = True Then ' check with config is it true or false
Dim sI, sMyNum, ab
For sI = 1 To 2
sMyNum = Int((9999 * Rnd(Now())) + 1)
If sMyNum > 1000 Then
scode.Value = sMyNum ' scode is used for satisfactory service
'GoTo ab
End If
Next
'ab
Dim aI, aMyNum
For aI = 1 To 10
aMyNum = Int((9999 * Rnd(Now())) + 1)
If aMyNum > 1000 Then
acode.Value = aMyNum ' acode is used for avrage service
End If
Next
Dim pI, pMyNum
For pI = 1 To 10
pMyNum = Int((9999 * Rnd(Now())) + 1)
If pMyNum > 1000 Then
pcode.Value = pMyNum 'pcode is used for Poor service
End If
Next
iscodegenerate = True
Else
iscodegenerate = False
MsgBox "Code is not generated : check your config setting"
End If
End Sub
I am working on customer care application and need to generate 3 code for asking review about service, I try to below code and generate it but every time I get same result, might be some where I doing wrong....please help me to rectify or you have any other way then plz plz guide me on it.
warmly welcome to valuable suggestion and correction
(Note: I am not a professional, but just keep focusing on my application work well by help of genius like you, so please bare with me if code found childes...
Currently Using code make easy explainable :
'Generate 4 Digit Random No between 1001 to 9000
Private Sub Command4_Click()
Dim GenerateCodeCheck As Boolean
GenerateCodeCheck = DLookup("generatecode", "ConfigT", "ConfigID = 1")
If GenerateCodeCheck = True Then ' check with config is it true or false
Dim sI, sMyNum, ab
For sI = 1 To 2
sMyNum = Int((9999 * Rnd(Now())) + 1)
If sMyNum > 1000 Then
scode.Value = sMyNum ' scode is used for satisfactory service
'GoTo ab
End If
Next
'ab
Dim aI, aMyNum
For aI = 1 To 10
aMyNum = Int((9999 * Rnd(Now())) + 1)
If aMyNum > 1000 Then
acode.Value = aMyNum ' acode is used for avrage service
End If
Next
Dim pI, pMyNum
For pI = 1 To 10
pMyNum = Int((9999 * Rnd(Now())) + 1)
If pMyNum > 1000 Then
pcode.Value = pMyNum 'pcode is used for Poor service
End If
Next
iscodegenerate = True
Else
iscodegenerate = False
MsgBox "Code is not generated : check your config setting"
End If
End Sub
Last edited: