HI,
I would like to know how I can use a for loop with a variable that can cycle through all letters (a to z)..
I tried some code, but it tells me that there is a type mismatch...
Here's my code...
Dim FirstDigit As Integer
Dim SecondDigit As Integer
Dim ThirdDigit As Integer
Dim FourthDigit As Integer
Dim FirstDigit2 As String
Dim SecondDigit2 As String
Dim ThirdDigit2 As String
Dim FourthDigit2 As String
Dim Keycode As String
Dim z As Integer
For FirstDigit = 0 To 9
For SecondDigit = 0 To 9
For ThirdDigit = 0 To 9
For FourthDigit = 0 To 9
Me.txtKeycodes.SetFocus
Me.txtKeycodes.Text = FirstDigit & SecondDigit & ThirdDigit & FourthDigit
For z = 0 To 4000
Next z
If FourthDigit = 9 Then
For FourthDigit2 = a To z
Me.txtKeycodes.SetFocus
Me.txtKeycodes.Text = FirstDigit & SecondDigit & ThirdDigit & FourthDigit2
Next FourthDigit2
End If
Next FourthDigit
Next ThirdDigit
Next SecondDigit
Next FirstDigit
End Sub
Is this possible? The code stops at the "for FourthDigit2 = a to z" part.
Thanks!
I would like to know how I can use a for loop with a variable that can cycle through all letters (a to z)..
I tried some code, but it tells me that there is a type mismatch...
Here's my code...
Dim FirstDigit As Integer
Dim SecondDigit As Integer
Dim ThirdDigit As Integer
Dim FourthDigit As Integer
Dim FirstDigit2 As String
Dim SecondDigit2 As String
Dim ThirdDigit2 As String
Dim FourthDigit2 As String
Dim Keycode As String
Dim z As Integer
For FirstDigit = 0 To 9
For SecondDigit = 0 To 9
For ThirdDigit = 0 To 9
For FourthDigit = 0 To 9
Me.txtKeycodes.SetFocus
Me.txtKeycodes.Text = FirstDigit & SecondDigit & ThirdDigit & FourthDigit
For z = 0 To 4000
Next z
If FourthDigit = 9 Then
For FourthDigit2 = a To z
Me.txtKeycodes.SetFocus
Me.txtKeycodes.Text = FirstDigit & SecondDigit & ThirdDigit & FourthDigit2
Next FourthDigit2
End If
Next FourthDigit
Next ThirdDigit
Next SecondDigit
Next FirstDigit
End Sub
Is this possible? The code stops at the "for FourthDigit2 = a to z" part.
Thanks!