Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Easy one - function with table and field
Message
From
26/09/2004 17:23:59
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Easy one - function with table and field
Miscellaneous
Thread ID:
00946132
Message ID:
00946132
Views:
64
Hi everyone:

I think I have an easy one here for anyone willing to help. Unfortunately, I have spent a number of hours on this and I can't make it work.

I have a function to replace two character portions of a field in a table (see below) with two parameters, one a table (tctable), and the other a field (cfield). Unfortunately, when I pass a field name to the function, it either doesn't work (the variable cfield is not valid) or it replaces the value in the field with the name passed to it, ie "cfield". I am not sure how to pass the field name to the function so that the changes are being made to the actual field values.

any suggestions? thanks.

FUNCTION replacechar(tctable, cfield)
CLOSE ALL
USE (tctable)
GO top
SCAN
oldstring = 'cfield'
newstring1 = STRTRAN(oldstring,'(', '')
newstring2 = strTRAN(newstring1,') ','-')
replace 'cfield' WITH newstring2
ENDSCAN
ENDfunc
Next
Reply
Map
View

Click here to load this message in the networking platform