Results 1 to 3 of 3
  1. #1
    steve183 is offline Novice
    Windows 7 Access 2003
    Join Date
    Jun 2010
    Posts
    2

    Help with code

    I'm working on a donation database and I'm a beginner to some degree. A real nebie with code. I've got this txtbox on my mainform and the below code is from a query. It seems to me that the below code could maybe be put in VBA on "after the update" The reason I'm asking for help is the level of donations is going to be growing and it will make a long string in the query grid. Is there another way to write this is vba?

    Any help would be appreciated as I'm somewhat lost.

    Level: Switch([SumOfDonationAmount] Between 1 And 999," Bronze",
    [SumOfDonationAmount] Between 1000 And 4999," Silver",
    [SumOfDonationAmount] Between 5000 And 9999," Gold",


    [SumOfDonationAmount] Between 10000 And 14999," Platinum")

  2. #2
    TheShabz is offline Court Jester
    Windows XP Access 2003
    Join Date
    Feb 2010
    Posts
    1,368
    Lets assume the txtbox that the level will be going into is called txtLevel.

    Select Case SumOfDonationAmount
    Case <1000
    Me.txtLevel = "Bronze"
    CASE >=1000 AND <5000
    Me.txtLevel = "Silver"
    Case >=5000 AND <10000
    Me.txtLevel = "Gold"
    Case >=10000 AND <15000
    Me.txtLevel = "Platinum"
    Case Else
    'error catching here
    End Select

  3. #3
    steve183 is offline Novice
    Windows 7 Access 2003
    Join Date
    Jun 2010
    Posts
    2
    Thankyou TheShabz, I'm going to give it a try

    Regards

Please reply to this thread with any new information or opinions.

Similar Threads

  1. how to get to the raw code
    By YankeeImperialistDog in forum Programming
    Replies: 1
    Last Post: 03-05-2010, 01:55 PM
  2. Help with VBA code
    By bgonzal1 in forum Access
    Replies: 3
    Last Post: 12-14-2009, 07:12 AM
  3. Access 2003 code vs Access 2007 Code
    By ralphjramirez in forum Access
    Replies: 5
    Last Post: 11-23-2009, 12:33 PM
  4. Need help with code
    By hoenheim in forum Programming
    Replies: 9
    Last Post: 09-11-2008, 04:19 PM
  5. Need Help Getting to Code
    By Snuffles in forum Programming
    Replies: 8
    Last Post: 04-22-2008, 05:25 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums