matthewbeetle
08-11-2001, 05:28 PM
Hi everyone!!!
I'm using the microsoft common control to add a save/open option to my form. Is there anyway of allowing a variable entered into the form to automatically be entered as the default save name?
i've found the line:
CD1.Filename = App.Path & ""
puts the default save name as the folder name where the project is located, but i can't seem to get it to work with variables. Any help on this would be much appreciated!
many thanks
mat
Squirm
08-11-2001, 05:31 PM
What do you mean by variables? What code have you tried (and failed with)? You could use this for example:
<font color=blue>CD1.Filename = App.Path & "\" & variable & ".doc"</font color=blue>
Or something similar.
matthewbeetle
08-11-2001, 05:38 PM
in the first form the user is asked to enter a date. On the second form i'm trying to get the default save name as the date entered. only i can't seem to get it to anything other than the folder name the project is stored in.
Thinker
08-11-2001, 05:41 PM
What format is that date in? You can't have / or \ in filenames.
I think therefore I am... sometimes right. images/icons/wink.gif
Squirm
08-11-2001, 05:46 PM
If the user enters the date that could cause problems, you will have to parse out any unwanted characters first. First make the date into a string then go through with a loop deleting and compacting the string as you go. Then use the code I posted above.
matthewbeetle
08-11-2001, 05:47 PM
That's it now i come you come to mention it. The date is of the format ##/##/####, and an input mask is used to enter it. Is there a way of getting just the numbers entered to be the default save name, or am i just hoping? - Thanks!
Squirm
08-11-2001, 05:49 PM
Read my post above.... directly above. images/icons/smile.gif
Thinker
08-11-2001, 05:52 PM
You can use string manipulation functions like
strFileName = Left$(mydate,2) & Mid$(mydate,4,2) & Right$(mydate,4)
This will only work if the date is always in the format ##/##/####
I think therefore I am... sometimes right. images/icons/wink.gif
Squirm
08-11-2001, 05:53 PM
However, if, as you claim, the user enters the date, that may be in many different formats depending on the method of entry you use.
rpeare
08-14-2001, 06:32 AM
I use quite a bit of variable naming of files depending on date and the method preferred here is using the julian day. I have some sample code if you're still looking for a solution.
rp
matthewbeetle
08-15-2001, 04:31 PM
Thanks for the reply to my question. I have since found a solution, but i am always looking for new ways of doing things, so any help would still be appreciated.
Many thanks
mat