ProductCart E-Commerce Solutions Homepage
Forum Home Forum Home > ProductCart > Customizing ProductCart
  New Posts New Posts RSS Feed - Gift certificate code
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Gift certificate code

 Post Reply Post Reply
Author
Message
cpgmar View Drop Down
Newbie
Newbie
Avatar

Joined: 04-December-2005
Location: United States
Status: Offline
Points: 2
Post Options Post Options   Thanks (0) Thanks(0)   Quote cpgmar Quote  Post ReplyReply Direct Link To This Post Topic: Gift certificate code
    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
Back to Top
njessen42 View Drop Down
Groupie
Groupie
Avatar

Joined: 12-November-2007
Location: Spokane, WA
Status: Offline
Points: 0
Post Options Post Options   Thanks (0) Thanks(0)   Quote njessen42 Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
Guests View Drop Down
Guest
Guest
Post Options Post Options   Thanks (0) Thanks(0)   Quote Guests Quote  Post ReplyReply Direct Link To This Post 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)
 
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.04
Copyright ©2001-2021 Web Wiz Ltd.

This page was generated in 0.016 seconds.