Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Samir H.
  Where is Samir H.?
 Yogyakarta
 Indonesia
 Samir H.
 To: Jun Tangunan
  Where is Jun Tangunan?
 Cabanatuan
 Philippines
 Jun Tangunan
 Tags
Subject: RE: rename table if
Thread ID: 289214 Message ID: 289259 # Views: 26 # Ratings: 0
Version: Visual FoxPro 9 Category: Forms
Date: Thursday, December 30, 2010 5:31:06 AM         
   


> > hi all,
> >
> > i need to create new table and display message as "this table don befor" if found
> >
> >
> >
> >  file_to_copy= "month"+alltrim(str(month(date()))+alltrim(str(year(date()))))+".dbf"
> >  **file_to_copy=month12011
> > 
> >  SELECT * FROM mycur WHERE VAL(f1)<>99 INTO TABLE file_to_copy 
> > 
> > *loctae for   month12011
> >  
> >  * =messagebox("DON BEFOR")
> > 

> > thanks
>
>
> I saw that you already got what you need but I just want to add some more:
>
> a. The easiest way to combine the dates to a character is by using DTOS() like this:
>
file_to_copy = "Month"+dtos(date())+".dbf"

>
> Although maybe you really wanted your format, so a cleaner code would be to use TRANSFORM():
>
file_to_copy= "month"+TRANSFORM(MONTH(DATE()))+TRANSFORM(YEAR(DATE()))+".dbf"

>
>
> b. IMHO, it is better to add the flag 1 on FILE():
>
IF FILE(file_to_copy)      &&  will return false if file is marked as system or hidden
> IF FILE(file_to_copy,1)    &&  will return true regardless if file is marked as system or hidden
> 
> 

> That goes the same with DIRECTORY(). A numeric flag of 1 is better to ensure that it will include in the checking the marked hidden or system ones.
>
>
> http://www.junblogs.com/
> http://weblogs.foxite.com/sandstorm36/default.aspx
> http://www.coderisland.com/forum/viewforum.php?f=10


Hi Jun
Why do you think transform() is cleaner? I always use ltrim(str()) for numerics, it is faster...
file_to_copy= "month"+ltrim(str(month(date())))+ltrim(str(year(date())))+".dbf"

file_to_copy= "month"+TRANSFORM(MONTH(DATE()))+TRANSFORM(YEAR(DATE()))+".dbf"



Regards
Samir

ENTIRE THREAD

rename table if Posted by mohammed qasem @ 12/29/2010 3:15:43 PM
RE: rename table if Posted by Ony Too @ 12/29/2010 3:35:29 PM
RE: rename table if Posted by Samir H. @ 12/29/2010 3:35:53 PM
RE: rename table if Posted by mohammed qasem @ 12/29/2010 3:47:13 PM
RE: rename table if Posted by Jun Tangunan @ 12/30/2010 5:22:29 AM
RE: rename table if Posted by Samir H. @ 12/30/2010 5:31:06 AM
RE: rename table if Posted by Jun Tangunan @ 12/30/2010 5:46:44 AM
RE: rename table if Posted by Ony Too @ 12/30/2010 10:56:48 AM
RE: rename table if Posted by Samir H. @ 12/30/2010 11:47:25 AM