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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What's the equivalent of Access's Switch(,,) statement

Status
Not open for further replies.

robmoors

Programmer
Jan 10, 2001
24
Can someone please tell me what's the equivalent of Access's Switch(,,) statement in Foxpro. I know the IIF statement but not the Switch.
 
I'm not sure there is an exact replacement. I'd think, however, that you could do the same thing with a do case ... endcase statement, though the code might be a bit longer. Thus to use the example my Access has using the switch function

Code:
DO CASE
       CASE CityName = "London"
                MatchUp = "English"
       CASE CityName = "Paris"
                MatchUp = "French"
       CASE CityName = "Rome"
                MatchUp = "Italian"
       OTHERWISE
                MatchUp = "No Match"
ENDCASE

The case structure has a lot more capabilities, but the visible overhead is a bit larger.

Dave Dardinger
 
OTTOMH, I cant think of one in VFP6. To achieve the same functionality, you can use nested IIFs, a case statement, and there's also the Inlist function. Jon Hawkins
 
I don't know Access, but if switch is replacing one string with another, look in your help files for STRTRAN().
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top