Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Use of Case statement ?? 1

Status
Not open for further replies.

storyboy

Programmer
Sep 16, 2004
25
US
I have programmed before in Clipper, used Case statement and found it a wonderful tool. Checked all the books at Barns & Noble on Access 2003 and VB could find no such tool available. Then in one of the answers to another question an individual had, saw it used. "Select Case", I do hope someone can tell me if it does exist for use in Access 2003. This is why. I have products to invoice for. Each product has six prices available, Price1, Price2, Price3, etc. The user can enter price code 1 thru 6. So I end up with the simple situation of If pricecode = 2, Qty * Price2 = costofitems. or If pricecode = 3, Qty * price3 = costofitems, etc. As you can see from this, a Select Case would be great, else I don't see an easy way to do this. Help with this would be appreciated.

My form is frmproducts and the price code control is txtpc, the six prices in the product file are curprice1,curprice2, curprice3, etc. The product is found easily with txtprodcode.
Price
Qty. Code Desc. Code Cost Ext. Cost
22 1234 coffee 2 _______ ________

I do hope this information is complete enough, else let me know right away.
If Select Case for Access does not exist, please help me with direction for achieving same sort of results.
Tom
 
Tom,

Select Case is standard VB and is available in VBA
Code:
select case pricecode
  case 1

  case 2

....
  case else

end select


Skip,

[glasses] [red]Be advised:[/red] When transmitting sheet music...
If it ain't baroque, don't fax it! [tongue]
 
Skip,

Thank you so much, went right out purchased another book, on visual basic that had the commands in it. Had to look some to find right book but your telling me it was a basic statement put me on the track that somewhere it was written. Sure enough got the right book. I used to write lots of code, Cobol, Fortran, Clipper, Dbase, etc. Now learning this, so far seems fun.
Tom, storyboy
 
Tom,

I started out, 40 years ago punching up a little FORTRAN on Hollerith cards in college as a EE student. Then 10 years later learned BASIC on the DEC PDP 8. Then picked up a bit of COBOL in the 80s.

VB and VBA uses objects, so getting to understand collections and then properties and methods is a bit different than those older languages.

You'll get lots of good examples here as well as direct help. Good luck!

Skip,

[glasses] [red]Be advised:[/red] When transmitting sheet music...
If it ain't baroque, don't fax it! [tongue]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top