toqilula
04-20-2011, 09:44 AM
Hello VBA lovers :hi:
I Have wrote a simple code in java and i would very much like to be able to use it in ms access.
Could someone translate it in vba please.
I know it will be easy for most of the ppeople programming in VBA, cose it has only two loopes and some string variables.
So I would really much appreciate if you can help me.
here is the code writen i java:
public class mod36 {
public static void main (String [] arg){
String _sIn = "GYM014650000005";
String sCharPool = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String[] sArrayIn = new String [15];
char c;
for (int i = 0; i < 15; i++){
c = _sIn.charAt(i);
sArrayIn[i] = Character.toString(c);
}
int iSum = 0;
for (int iCount = 0; iCount < 15; iCount++) {
iSum = iSum + sCharPool.indexOf(sArrayIn[iCount].toUpperCase()) * (16 - iCount);
}
int iCtrl = iSum % 36;
System.out.println ("rez: " + _sIn + sCharPool.substring(iCtrl, iCtrl + 1));
}}
I Have wrote a simple code in java and i would very much like to be able to use it in ms access.
Could someone translate it in vba please.
I know it will be easy for most of the ppeople programming in VBA, cose it has only two loopes and some string variables.
So I would really much appreciate if you can help me.
here is the code writen i java:
public class mod36 {
public static void main (String [] arg){
String _sIn = "GYM014650000005";
String sCharPool = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
String[] sArrayIn = new String [15];
char c;
for (int i = 0; i < 15; i++){
c = _sIn.charAt(i);
sArrayIn[i] = Character.toString(c);
}
int iSum = 0;
for (int iCount = 0; iCount < 15; iCount++) {
iSum = iSum + sCharPool.indexOf(sArrayIn[iCount].toUpperCase()) * (16 - iCount);
}
int iCtrl = iSum % 36;
System.out.println ("rez: " + _sIn + sCharPool.substring(iCtrl, iCtrl + 1));
}}