Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Select statement
Message
From
06/10/2005 03:00:43
 
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Environment versions
Visual FoxPro:
VFP 8
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01056147
Message ID:
01056622
Views:
37
hi,
thank you so much,
it works as what i need exactly ,
this is the code under
SET CENTURY on
SET DATE TO british
SELECT 1
USE table1
*Add a new field into Table1 named Period C(6)
m1 = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"
REPLACE ALL table1.Period WITH [2005]+PADL(INT(AT(UPPER(LEFT(DAT,3)),M1)/3)+1,2,"0")


*This must fill this field with 200501, 200502 etc. for the months.

*The there where you replace the field Dat put
REPLACE table1.Period WITH LEFT(DTOS(table1.dat),6)  && In function DTOS() put that 
*variable/object or something else from where you get the valuie of DAT 
*field.

*The your select must looks like:
SET CENTURY on
SET DATE TO british

SELECT 2
USE divi

m1 = "JANFEBMARAPRMAYJUNJULAUGSEPOCTNOVDEC"
m.nam=nam
m.dat1=RIGHT(thisform.Text1.Value,4)+PADL(INT(AT(UPPER(LEFT(thisform.Text1.Value,3)),M1)/3)+1,2,"0") 

m.dat2=RIGHT(thisform.Text2.Value,4)+PADL(INT(AT(UPPER(LEFT(thisform.Text2.Value,3)),M1)/3)+1,2,"0") 

SELECT *  from table1 WHERE   (Period between m.dat1 AND m.dat2) AND dvno=VAL  (this.Value) and peri=thisform.combo2.value  ;
  into CURSOR xyz
IF _TALLY > 0
     *report form newtable1 preview
     brow
ELSE
=MESSAGEBOX("Still No Product")
endif
thanks again
have a nice day
m.qasem

>Can you send me the form and some simple data?
>>hi,
>>What type is Dat field? character type.
>>
>>thanks.
>>
>>>What type is Dat field?
>>>
>>>>hi,
>>>>thank you,
>>>>the type is date ,but i get it at my text via calender,
>>>>Yes,dat field at my table.
>>>>
>>>>thisform.text1.value= CMONTH(This.object.value)+' '+Str(year(This.object.value))
>>>>&&thisform.olecontrol1.Visible=.f.
>>>>
>>>>>Mohhamed,
>>>>>What type are m.dat1, m.dat2 AND dat. I hope Dat is Field from table
>>>>>
>>>>>
>>>>>>hi all,
>>>>>>any idea ,help.
>>>>>> to fix this code under,
>>>>>> I want to see only what I choice between to dates but I see all months,
>>>>>> thanks.
>>>>>>
>>>>>>
>>>>>>
>>>>>>SET CENTURY on
>>>>>>SET DATE TO british
>>>>>>SELECT divi
>>>>>>m.nam=nam
>>>>>>m.dat1=thisform.text1.Value  && result is january   2005
>>>>>>m.dat2=thisform.text2.Value  && result is feb...2005 or any month i choice
>>>>>>SELECT table1 && error message table1 not found, I need to use it to make index
>>>>>>INDEX ON dat TO kk
>>>>>>
>>>>>> SELECT * from table1 WHERE   (dat between m.dat1 AND m.dat2) AND dvno=VAL(this.Value) and peri=thisform.combo2.value ;
>>>>>>     into CURSOR xyz
>>>>>>IF _TALLY > 0
>>>>>>             report form newtable1 preview
>>>>>>  ELSE
>>>>>>        =MESSAGEBOX("Still No Product")
>>>>>>
>>>>>>Endif
>>>>>>
>>>>>>m.qasem
Previous
Reply
Map
View

Click here to load this message in the networking platform