Approach User Support homepage Approach User Support
Answers to Frequently Asked Questions about Lotus Approach
Examples LotusScripts
Example databases
Links to other Lotus Approach support services

[Return to contents]

Using the contents of a variable field as an export filename

Last updated: 13 Jul 1999

Create an macro that performs the required export to a set filename (say c:\temp\tempdata.dbf), then runs the script shown below. The script copies the exported file to the desired diskdrive, filename and directory contained in a variable field (VarField). For the script to work, the variable field must be displayed on the current view.

Sub Rename
    Dim filename As String
    filename$ = Cstr(currentview.body.VarField.text)
    Filecopy "c:\temp\tempdata.dbf", filename$
End Sub

If you want the variable field to only contain the filename then use the following variation:

Sub Rename
    Dim filename As String
    filename$ = Cstr(currentview.body.VarField.text)
    Filecopy "c:\temp\tempdata.dbf", "c:\path\"&filename$&".dbf"
End Sub

If you don't know the path name of the destination file (because it's on a network, or installed on different computers), you could use the LotusScript function in article "Getting the path of a database file" in this FAQ.

The next script basically does the same thing as the first, except that it renames the file rather than creating a new copy of it.

Sub MyReName
     Name "c:\temp\tempdata.dbf" As filename$
End Sub

[Return to contents]

© Copyright, JohnBrown, Trademarks, Disclaimer, Acknowledgements.