Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sql select /combo box problems
Message
De
22/07/1998 12:27:52
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
22/07/1998 11:41:00
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Divers
Thread ID:
00119976
Message ID:
00120245
Vues:
46
>Hi Cetin:
>
>Thanks for helping me again. I have one other small problem, when I select the
>casemang or nddetby person from my combobox list I get all the records
>for the criteria - meaning if I select noone I get all the records and If a select " bill smith" I get all the reocrds even if he isn't the casemang or nddetby for this record. Do I need to put coun_sum.casemang = thisform.combo2.value or coun_sum.nddetby = thisform.combo2.value somewhere else? Here is the code.
>str = ""
>If empty(ctod(Thisform.text1.value)) and empty(ctod(Thisform.text2.value))
> str = " "
>Else
> If empty(ctod(Thisform.text1.value))
> str = "and act_plan.follow_dte <= ctod(Thisform.text2.value)"
> Endif
> If empty(ctod(Thisform.text2.value))
> str = "and act_plan.follow_dte >= ctod(Thisform.text1.value)"
> Endif
> If not empty(ctod(Thisform.text1.value)) and not empty(ctod(Thisform.text2.value))
> str = "and act_plan.follow_dte >= ctod(Thisform.text1.value) and act_plan.follow_dte <= ctod(ThisForm.text2.value)"
> Endif
>Endif
>set talk on
>select distinct client.sin, allt(client.surname) + ", " + allt(client.firstname);
>as fullname, client.phone1;
>from client;
>inner join coun_sum;
> on client.sin = coun_sum.sin;
>inner join act_plan;
> on act_plan.sin = coun_sum.sin;
>where(coun_sum.casemang = thisform.combo2.value or coun_sum.nddetby = thisform.combo2.value);
>and !empty(act_plan.follow_dte) &str;
>and act_plan.fld_up < 1 or act_plan.fld_up > 1;
>into cursor finalcursor
>
>If reccount() = 0
> messagebox("There are no records found!", 48, "CATS")
>Endif
>set talk off
>
>
>
>REPORT FORM counrpt HEADING "ACTION PLAN BF REPORT" PREVIEW
Sheena,
Revised a little. W/o sample data it's being hard where it fails. Try this one and inform me.
* Some modification for my eyes

ldStart = ctod(Thisform.text1.value)	&& Convert to date values
ldEnd   = ctod(Thisform.text2.value)
if ldEnd < ldStart   					&& Swap if needed
	ldTemp	= ldStart
	ldStart	= ldEnd
	ldEnd	= ldTemp
endif
ldStart	= max(ldStart, {01/01/100})		&& Make sure they are !empty()
ldEnd	= min(ldEnd, {01/01/9999}+364)  && Safety belt for set date
* lcWhere = " and act_plan.follow_dte BETWEEN ldStart AND ldEnd " && str - No need - directly in SQL
* also replaces !empty(follow_dte)

* Some modification for my eyes
m.ComboValue = thisform.combo2.value

set talk on
select distinct client.sin, allt(client.surname) + ", " + allt(client.firstname) ;
    as fullname, client.phone1 ;
  	from client ;
	inner join coun_sum ;
		on client.sin = coun_sum.sin ;
	inner join act_plan ;
		on act_plan.sin = coun_sum.sin ;
	where (coun_sum.casemang = m.ComboValue or coun_sum.nddetby = m.ComboValue) ;
	and act_plan.follow_dte BETWEEN ldStart AND ldEnd ;
	and act_plan.fld_up # 1 ;
	into cursor finalcursor
		
If reccount() = 0
	messagebox("There are no records found!", 48, "CATS")
Endif
set talk off
browse    && Check here what you get - Report might have its own environment
REPORT FORM counrpt HEADING "ACTION PLAN BF REPORT" PREVIEW
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform