Print Page | Close Window

Gift certificate code

Printed From: ProductCart E-Commerce Solutions
Category: ProductCart
Forum Name: Customizing ProductCart
Forum Description: Exchange messages with other users that are customizing ProductCart.
URL: https://forum.productcart.com/forum_posts.asp?TID=3096
Printed Date: 23-July-2025 at 10:03am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: Gift certificate code
Posted By: cpgmar
Subject: Gift certificate code
Date Posted: 10-October-2009 at 1:04pm
I need to alter the Gift Certificate code generator to generate a code with only 5 digits with all cap letters (no small letters) Does anyone know how to revise this code below to make it do that?

'--- Start Generating Gift Code - This is just SAMPLE CODE
                Tn1=""
                For w=1 to CodeStrLen
                    Randomize
                    myC=Fix(3*Rnd)
                    Select Case myC
                        Case 0:
                        Randomize
                        Tn1=Tn1 & Chr(Fix(26*Rnd)+65)
                        Case 1:
                        Randomize
                        Tn1=Tn1 & Cstr(Fix(10*Rnd))
                        Case 2:
                        Randomize
                        Tn1=Tn1 & Chr(Fix(26*Rnd)+97)       
                    End Select
                Next
'--- Finish Generating GiftCode   


-------------
Cindy

The Tasteful Garden

www.tastefulgarden.com



Replies:
Posted By: njessen42
Date Posted: 22-October-2009 at 4:29pm
I tried to remove
Case 2:
Randomize
Tn1=Tn1 & Chr(Fix(26*Rnd)+97)       

to get 10 digits with all uppercase letters and numbers and it still created lower case. What am I doing wrong.

For the above question I think you can change

CodeStrLen=10 to 5 and you should get a 5 digit code. I am trying to figure out the lower case letter thing also.


Posted By: Guests
Date Posted: 22-October-2009 at 8:47pm

I'm not clear on whether you are wanting just alpha or if the alpha-numeric is OK, but to convert your lower case to upper case you should be able to simply add this after the For . . .Next loop:

Tn1=UCase(Tn1)
 



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net