Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Import from fails
Message
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Miscellaneous
Thread ID:
00279051
Message ID:
00279140
Views:
11
>If I enter this line of code in my application it works:
>
>import from "C:\Data\dBases\Beyond Gold\Test.xls" database BG name Incoming type xl8 as 1252
>
>If I save "C:\Data\dBases\Beyond Gold\Test.xls" to a variable m.Test and then use that thusly:
>
>import from m.Test database BG name Incoming type xl8 as 1252
>or
>import from &m.Test database BG name Incoming type xl8 as 1252
>or
>import from eval(m.Test) database BG name Incoming type xl8 as 1252
>
>all fail with file not found.
>
>Is there any way of using Import From with a variable file name?
>

Try:

import from (m.test) database BG name Incoming type xl8 as 1252

this is using name resolution rather than expression evaluation or macro expansion, and is the best option where a VFP command expects a name but you've stuck the name in a field, variable or property, or is a return from a function or method call. For example:
import from (GETFILE('XLS|XL8','Gimme a spreadsheet to read','Read')) database BG name Incoming type xl8 as 1252
works just fine as long as you get a file name back...


>TIA
>
>DJ
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Reply
Map
View

Click here to load this message in the networking platform