Página 1 de 1

Bloquear Textbox no Preenchimento de Outra

Enviado: 17 Nov 2013 11:20
por guanabara
Bom dia, tenho um programinha que faz varias pesquisas em um banco Firebird atraves das TextBox conforme imagem abaixo, ta funcionando direitinho, so que gostaria que quando digitasse a primeira letra no campo a ser pesquisado tipo a TextBox (Numero do CPF) as demais TextBox ficassem impreenchiveis tipo com o comando READONLY .T. para as demais, podendo preencher somente um campo de pesquisa por vez.... Sera que consegui explicar.... nao sei como fazer... Se alguem me puder ajudar....
Tela.jpg

Código: Selecionar todos

*------------------------------------------------------------------------------*
* PROGRAMA   : CONSULTA NACIONAL
* PROGRAMADOR: WELLINGTON JR.
* COLABORACAO: Pablo Cesar / Luiz Antonio da Silva
* CRIACAO    : 27/08/2013 
*------------------------------------------------------------------------------*

#INCLUDE "hmg.ch"
#INCLUDE "ADODB.CH"
#DEFINE  HBA HB_OEMTOANSI

*------------------------------------------------------------------------------*
*                       PROCEDURE MAIN
*------------------------------------------------------------------------------*

Function Main
 
PUBLIC _PASTA    :=GETSTARTUPFOLDER()
PUBLIC _PastaArq  := GetCurrentFolder() + "\ARQUIVOS"
PUBLIC ARQCFG:=_PASTA+"\BANCO.INI"

PUBLIC R_IP := '127.0.0.1'
PUBLIC R_CM := GETSTARTUPFOLDER() + "\BANCO" 
PUBLIC R_BD := 'CONSULTANACIONAL.FDB'
PUBLIC R_FB := '1'

SET DELETED ON
SET DATE BRIT
SET CENTURY ON
SET EPOCH TO 1960
SET MULTIPLE OFF
SET AUTOPEN OFF

*------------------------------------------------------------------------------*
*         VERIFICA A EXISTENCIA DO ARQUIVO BANCO.INI
*------------------------------------------------------------------------------*

*if file(ARQCFG)

*   BEGIN INI FILE (ARQCFG)
*     GET R_IP      SECTION 'FIREBIRD'   ENTRY 'IP'
*     GET R_CM      SECTION 'FIREBIRD'   ENTRY 'CM'
*     GET R_BD      SECTION 'FIREBIRD'   ENTRY 'BD'
*     GET R_FB      SECTION 'FIREBIRD'   ENTRY 'FB'
*   END INI
   
*else

*   MSGINFO("BANCO.INI NAO ENCONTRADO")
   
*endif

*------------------------------------------------------------------------------*
*   LE O CONTEUDO DO ARQUIVO BANCO.INI E CONECTA AO BANCO
*------------------------------------------------------------------------------*

opc:=.t.

if VAL(R_FB)<>0
   RIP:=R_IP
   RCM:=R_CM
   RBD:=R_BD
if LEN(RIP)=0 .OR. ALLTRIM(RIP)="127.0.0.1"
      _ARQUIVO:=":"+RCM+"\"+RBD
else
      _ARQUIVO:="\\"+ALLTRIM(RIP)+"\"+ALLTRIM(RCM)+"\"+ALLTRIM(RBD)
endif

while .T.

   OKX:="S"
      Try
         FDB:=CreateObject("ADODB.Connection")
         FDB:Open("DRIVER=Firebird/InterBase(r) driver;UID=SYSDBA;PWD=masterkey;DBNAME="+ _ARQUIVO +";CHARSET=WIN1252;DIALECT=3;CLIENT=fbclient.dll")
         Catch e
         CLOSE(FDB)
         OKX:="N"
End
      
if OKX="S"
   EXIT
else
         OPC:=MSGYESNO(HBA("ERRO NA CONEXÇO COM FIREBIRD")+CRLF+"TENTAR NOVAMENTE ?","ERRO")
         IF OPC=.F.
            EXIT
         endif
      endif
   enddo
endif

if opc=.f.; quit; endif

   name := 'cpdf'
   window := 'main'
   define window main at 43, 4 width 1350 height 660 TITLE "Consulta Nacional - Wellington© - V. 1.0 " main ICON "AGENDA"

*------------------------------------------------------------------------------*
*                       BARRA DE STATUS
*------------------------------------------------------------------------------*
         
		DEFINE STATUSBAR 
			STATUSITEM " Wellington 2013© - V. 1.0 " 
			CLOCK
			DATE
                 
		END STATUSBAR
      
*------------------------------------------------------------------------------*
*                               MODO PESQUISA
*------------------------------------------------------------------------------*
	
      DEFINE LABEL Label_CPF
             ROW 5; COL 10; WIDTH 300; HEIGHT 15; VALUE 'Numero do CPF'; FONTBOLD .T.
		END LABEL
      
      DEFINE LABEL Label_Fone
             ROW 5; COL 270; WIDTH 300; HEIGHT 15; VALUE 'DDD + Telefone Fixo/Celular'; FONTBOLD .T.
		END LABEL
      
      DEFINE LABEL Label_Mae
             ROW 5; COL 530; WIDTH 300; HEIGHT 15; VALUE 'Nome da Mae'; FONTBOLD .T.
		END LABEL
       
	 	DEFINE LABEL Label_Nome
             ROW 55; COL 10; WIDTH 300; HEIGHT 15; VALUE 'Nome'; FONTBOLD .T.
		END LABEL
      
      DEFINE LABEL Label_Bairro
             ROW 55; COL 270; WIDTH 300; HEIGHT 15; VALUE 'Bairro'; FONTBOLD .T.
		END LABEL
      
      DEFINE LABEL Label_Cidade
             ROW 55; COL 530; WIDTH 300; HEIGHT 15; VALUE 'Cidade'; FONTBOLD .T.
		END LABEL
      
      DEFINE LABEL Label_Uf
             ROW 55; COL 790; WIDTH 300; HEIGHT 15; VALUE 'Uf'; FONTBOLD .T.
		END LABEL
      
*------------------------------------------------------------------------------*
*                    PESQUISA PELO CPF
*------------------------------------------------------------------------------*      
      
      DEFINE TEXTBOX GetCPF
			    ROW		25
			    COL		10
			    WIDTH   250
            ONENTER INICIO() 
            * ONENTER		(If(main.GETCPF.Enabled:=.f., Inicio(),)) 
              
			    TOOLTIP		' Digite aqui o CPF a ser Pesquisado. '
			    UPPERCASE	.T.
        *     READONLY   .T.
		END TEXTBOX   

*------------------------------------------------------------------------------*
*                    PESQUISA PELO TELEFONE
*------------------------------------------------------------------------------*      
      
      DEFINE TEXTBOX GetFone
			    ROW		25
			    COL		270
			    WIDTH   250
             ONENTER INICIO() 
			    TOOLTIP		' Digite aqui o DD + Telefone a ser Pesquisado '
			    UPPERCASE	.T.
		END TEXTBOX 
      
*------------------------------------------------------------------------------*
*                    PESQUISA PELO NOME DA MAE
*------------------------------------------------------------------------------*      
      
      DEFINE TEXTBOX GetMae
			    ROW		25
			    COL		530
			    WIDTH   290
             ONENTER INICIO() 
			    TOOLTIP		' Digite aqui o nome da Mae a ser Pesquisado '
			    UPPERCASE	.T.
		END TEXTBOX 
      
      
          
*------------------------------------------------------------------------------*
*                       PESQUISA PELO NOME
*------------------------------------------------------------------------------*      
      
      DEFINE TEXTBOX GetNome
			    ROW		75
			    COL		10
			    WIDTH   250
             ONENTER INICIO()
             *ONENTER		(If(CAD.BotaoPesquisa.Enabled, Inicio(),)) 
			    TOOLTIP		' Digite aqui o Nome a ser Pesquisado. '
			    UPPERCASE	.T.
		END TEXTBOX
      
*------------------------------------------------------------------------------*
*                       PESQUISA PELO BAIRRO
*------------------------------------------------------------------------------*      
      
      DEFINE TEXTBOX GetBairro
			    ROW		75
			    COL		270
			    WIDTH   250
             ONENTER INICIO()
			    TOOLTIP		' Digite aqui o Bairro a ser Pesquisado. '
			    UPPERCASE	.T.
		END TEXTBOX

*------------------------------------------------------------------------------*
*                       PESQUISA PELA CIDADE
*------------------------------------------------------------------------------*      
      
      DEFINE TEXTBOX GetCidade
			    ROW		75
			    COL		530
			    WIDTH   250
             ONENTER INICIO()
			    TOOLTIP		' Digite aqui a Cidade a ser Pesquisada. '
			    UPPERCASE	.T.
		END TEXTBOX 

*------------------------------------------------------------------------------*
*                       PESQUISA PELA UF
*------------------------------------------------------------------------------*      
      
      DEFINE TEXTBOX GetUf
			    ROW		75
			    COL		790
			    WIDTH   30
             ONENTER INICIO()
			    TOOLTIP		' Digite aqui a Unidade Federativa a ser Pesquisada. '
			    UPPERCASE	.T.
		END TEXTBOX 
      
   
    DEFINE FRAME Frame_Pesquisa
           ROW    10
           COL    977
           WIDTH  80
           HEIGHT 85
           FONTNAME "Arial"
           FONTSIZE 9
           FONTBOLD .T.
           FONTITALIC .F.
           FONTUNDERLINE .F.
           FONTSTRIKEOUT .F.
           CAPTION "Pesquisar"
           BACKCOLOR Nil
           FONTCOLOR Nil
           OPAQUE .T.  
    END FRAME 
   
    DEFINE FRAME Frame_Export
           ROW    10
           COL    1057
           WIDTH  200
           HEIGHT 85
           FONTNAME "Arial"
           FONTSIZE 9
           FONTBOLD .T.
           FONTITALIC .F.
           FONTUNDERLINE .F.
           FONTSTRIKEOUT .F.
           CAPTION "Exportacao"
           BACKCOLOR Nil
           FONTCOLOR Nil
           OPAQUE .T.  
    END FRAME 
    
        DEFINE FRAME Frame_Pasta
           ROW    10
           COL    1257
           WIDTH  80
           HEIGHT 85
           FONTNAME "Arial"
           FONTSIZE 9
           FONTBOLD .T.
           FONTITALIC .F.
           FONTUNDERLINE .F.
           FONTSTRIKEOUT .F.
           CAPTION "Pasta"
           BACKCOLOR Nil
           FONTCOLOR Nil
           OPAQUE .T.  
    END FRAME 
    
*------------------------------------------------------------------------------*
*                             GRID
*------------------------------------------------------------------------------*       

      DEFINE GRID Grid_1
             ROW    105
             COL    10
             WIDTH  1340
             HEIGHT 550
             ITEMS {}
             WIDTHS {110,   300,   250,    200,    70,   160,    40,     90,  100, 100, 150}
              HEADERS {'CPF','NOME','ENDERECO','BAIRRO','CEP','CIDADE','UF','NASCIMENTO','TELEFONE', 'COMPLEMENTO', 'MAE'}
      END GRID     
      
   end window
   
 
   _addGridToolBar( 'grid_1', 'main' )
   
MAXIMIZE WINDOW MAIN
ACTIVATE WINDOW MAIN

close(FDB)

RETU


*------------------------------------------------------------------------------*
*                      FUNCAO INICIO
*------------------------------------------------------------------------------*

FUNC INICIO()

Public cGetCpf    :=GetProperty("MAIN","GetCPF","Value")
Public cGetFone   :=GetProperty("MAIN","GetFone","Value")
Public cGetMae    :=GetProperty("MAIN","GetMae","Value")
Public cGetNome   :=GetProperty("MAIN","GetNome","Value"), nRecCountB := 0
Public cGetBairro  :=GetProperty("MAIN","GetBairro","Value")
Public cGetCidade  :=GetProperty("MAIN","GetCidade","Value")
Public cGetUF     :=GetProperty("MAIN","GetUF","Value")
Public csql       := ""

v_timeinicio := time()



delete item ALL from grid_1 of MAIN


If Empty ( cGetCpf ) .and. Empty ( cGetFone ) .and. Empty ( cGetMae ) .and. Empty ( cGetNome ) .and. Empty ( cGetBairro ) .and. Empty ( cGetCidade ) .and. Empty ( cGetUf )
   msgstop("Nenhum dos Campos Preenchidos! Preencha ao menos um campo!", "Atencao!")
   MAIN.GetCpf.setfocus 
   Return
EndIf

 
if !Empty ( cGetCpf )  
    csql := "select * from CONSULTA WHERE CONSULTA.CON_CPFCNPJ = '&cGetCpf' UNION SELECT * FROM CONSULTA1 WHERE CONSULTA1.CON_CPFCNPJ = '&cGetCpf' UNION SELECT * FROM BRASIL WHERE BRASIL.CON_CPFCNPJ = '&cGetCpf' UNION SELECT * FROM BRASIL1 WHERE BRASIL1.CON_CPFCNPJ = '&cGetCpf' UNION SELECT * FROM BRASIL2 WHERE BRASIL2.CON_CPFCNPJ = '&cGetCpf' UNION SELECT * FROM SPC WHERE SPC.CON_CPFCNPJ = '&cGetCpf' order by 1"
endif

if !Empty ( cGetFone )  
    csql := "select * from CONSULTA WHERE CONSULTA.CON_FONE = '&cGetFone' UNION select * from CONSULTA1 WHERE CONSULTA1.CON_FONE = '&cGetFone' UNION select * from BRASIL WHERE BRASIL.CON_FONE = '&cGetFone' UNION select * from BRASIL1 WHERE BRASIL1.CON_FONE = '&cGetFone' UNION select * from BRASIL2 WHERE BRASIL2.CON_FONE = '&cGetFone' UNION select * from SPC WHERE SPC.CON_FONE = '&cGetFone' ORDER BY 10"
endif

if !Empty ( cGetMae )  
    csql := "select * from CONSULTA WHERE CONSULTA.CON_MAE = '&cGetMae' UNION select * from CONSULTA1 WHERE CONSULTA1.CON_MAE = '&cGetMae' UNION select * from BRASIL WHERE BRASIL.CON_MAE = '&cGetMae' UNION select * from BRASIL1 WHERE BRASIL1.CON_MAE = '&cGetMae' UNION select * from BRASIL2 WHERE BRASIL2.CON_MAE = '&cGetMae' UNION select * from SPC WHERE SPC.CON_MAE = '&cGetMae' ORDER BY 11"
endif


// CODIGO 1-0-0-0
if !Empty ( cGetNome ) .and. Empty ( cGetBairro ) .and. Empty ( cGetCidade ) .and. Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_NOME = '&cGetNome' UNION SELECT * FROM CONSULTA1 WHERE CONSULTA1.CON_NOME = '&cGetNome' UNION SELECT * FROM BRASIL WHERE BRASIL.CON_NOME = '&cGetNome' UNION SELECT * FROM BRASIL1 WHERE BRASIL1.CON_NOME = '&cGetNome' UNION SELECT * FROM BRASIL2 WHERE BRASIL2.CON_NOME = '&cGetNome' UNION SELECT * FROM SPC WHERE SPC.CON_NOME = '&cGetNome' order by 3"
endif

// CODIGO 1-1-0-0
if !Empty ( cGetNome ) .and. !Empty ( cGetBairro ) .and. Empty ( cGetCidade ) .and. Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_NOME = '&cGetNome' and CONSULTA.CON_BAIRRO = '&cGetBairro' UNION SELECT * FROM CONSULTA1 WHERE CONSULTA1.CON_NOME = '&cGetNome' and CONSULTA1.CON_BAIRRO = '&cGetBairro' UNION SELECT * FROM BRASIL WHERE BRASIL.CON_NOME = '&cGetNome' and BRASIL.CON_BAIRRO = '&cGetBairro' UNION SELECT * FROM BRASIL1 WHERE BRASIL1.CON_NOME = '&cGetNome' and BRASIL1.CON_BAIRRO = '&cGetBairro' UNION SELECT * FROM BRASIL2 WHERE BRASIL2.CON_NOME = '&cGetNome' and BRASIL2.CON_BAIRRO = '&cGetBairro'  UNION SELECT * FROM SPC WHERE SPC.CON_NOME = '&cGetNome' and SPC.CON_BAIRRO = '&cGetBairro' order by 2"
endif

// CODIGO 1-1-1-0
if !Empty ( cGetNome ) .and. !Empty ( cGetBairro ) .and. !Empty ( cGetCidade ) .and. Empty ( cGetUf ) 
   csql := "select * from CONSULTA WHERE CONSULTA.CON_NOME = '&cGetNome' and CONSULTA.CON_BAIRRO = '&cGetBairro' and CONSULTA.CON_CIDADE = '&cGetCidade' UNION SELECT * FROM CONSULTA1 WHERE CONSULTA1.CON_NOME = '&cGetNome' and CONSULTA1.CON_BAIRRO = '&cGetBairro' and CONSULTA1.CON_CIDADE = '&cGetCidade' UNION SELECT * FROM BRASIL WHERE BRASIL.CON_NOME = '&cGetNome' and BRASIL.CON_BAIRRO = '&cGetBairro' and BRASIL.CON_CIDADE = '&cGetCidade' UNION SELECT * FROM BRASIL1 WHERE BRASIL1.CON_NOME = '&cGetNome' and BRASIL1.CON_BAIRRO = '&cGetBairro' and BRASIL1.CON_CIDADE = '&cGetCidade' UNION SELECT * FROM BRASIL2 WHERE BRASIL2.CON_NOME = '&cGetNome' and BRASIL2.CON_BAIRRO = '&cGetBairro' and BRASIL2.CON_CIDADE = '&cGetCidade'  UNION SELECT * FROM SPC WHERE SPC.CON_NOME = '&cGetNome' and SPC.CON_BAIRRO = '&cGetBairro' and SPC.CON_CIDADE = '&cGetCidade' order by 2"
endif

// CODIGO 1-1-1-1
if !Empty ( cGetNome ) .and. !Empty ( cGetBairro ) .and. !Empty ( cGetCidade ) .and. !Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_NOME = '&cGetNome' and CONSULTA.CON_BAIRRO = '&cGetBairro' and CONSULTA.CON_CIDADE = '&cGetCidade' and CONSULTA.CON_UF= '&cGetUf' UNION SELECT * FROM CONSULTA1 WHERE CONSULTA1.CON_NOME = '&cGetNome' and CONSULTA1.CON_BAIRRO = '&cGetBairro' and CONSULTA1.CON_CIDADE = '&cGetCidade' and CONSULTA1.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL WHERE BRASIL.CON_NOME = '&cGetNome' and BRASIL.CON_BAIRRO = '&cGetBairro' and BRASIL.CON_CIDADE = '&cGetCidade' and BRASIL.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL1 WHERE BRASIL1.CON_NOME = '&cGetNome' and BRASIL1.CON_BAIRRO = '&cGetBairro' and BRASIL1.CON_CIDADE = '&cGetCidade' and BRASIL1.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL2 WHERE BRASIL2.CON_NOME = '&cGetNome' and BRASIL2.CON_BAIRRO = '&cGetBairro' and BRASIL2.CON_CIDADE = '&cGetCidade' and BRASIL2.CON_UF= '&cGetUf' UNION SELECT * FROM SPC WHERE SPC.CON_NOME = '&cGetNome' and SPC.CON_BAIRRO = '&cGetBairro' and SPC.CON_CIDADE = '&cGetCidade' and SPC.CON_UF= '&cGetUf' order by 2"
endif


// CODIGO 1-0-1-1
if !Empty ( cGetNome ) .and. Empty ( cGetBairro ) .and. !Empty ( cGetCidade ) .and. !Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_NOME = '&cGetNome'  and CONSULTA.CON_CIDADE = '&cGetCidade' and CONSULTA.CON_UF= '&cGetUf' UNION SELECT * FROM CONSULTA1 WHERE CONSULTA1.CON_NOME = '&cGetNome' and CONSULTA1.CON_CIDADE = '&cGetCidade' and CONSULTA1.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL WHERE BRASIL.CON_NOME = '&cGetNome' and BRASIL.CON_CIDADE = '&cGetCidade' and BRASIL.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL1 WHERE BRASIL1.CON_NOME = '&cGetNome' and BRASIL1.CON_CIDADE = '&cGetCidade' and BRASIL1.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL2 WHERE BRASIL2.CON_NOME = '&cGetNome' and BRASIL2.CON_CIDADE = '&cGetCidade' and BRASIL2.CON_UF= '&cGetUf' UNION SELECT * FROM SPC WHERE SPC.CON_NOME = '&cGetNome' and SPC.CON_CIDADE = '&cGetCidade' and SPC.CON_UF= '&cGetUf' order by 2"
endif

// CODIGO 1-0-0-1
if !Empty ( cGetNome ) .and. Empty ( cGetBairro ) .and. Empty ( cGetCidade ) .and. !Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_NOME = '&cGetNome' and CONSULTA.CON_UF= '&cGetUf' UNION SELECT * FROM CONSULTA1 WHERE CONSULTA1.CON_NOME = '&cGetNome' and CONSULTA1.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL WHERE BRASIL.CON_NOME = '&cGetNome' and BRASIL.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL1 WHERE BRASIL1.CON_NOME = '&cGetNome' and BRASIL1.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL2 WHERE BRASIL2.CON_NOME = '&cGetNome' and BRASIL2.CON_UF= '&cGetUf' UNION SELECT * FROM SPC WHERE SPC.CON_NOME = '&cGetNome' and SPC.CON_UF= '&cGetUf' order by 2"
endif

// CODIGO 1-1-0-1
if !Empty ( cGetNome ) .and. !Empty ( cGetBairro ) .and. Empty ( cGetCidade ) .and. !Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_NOME = '&cGetNome' and CONSULTA.CON_BAIRRO = '&cGetBairro' and CONSULTA.CON_UF= '&cGetUf' UNION SELECT * FROM CONSULTA1 WHERE CONSULTA1.CON_NOME = '&cGetNome' and CONSULTA1.CON_BAIRRO = '&cGetBairro' and CONSULTA1.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL WHERE BRASIL.CON_NOME = '&cGetNome' and BRASIL.CON_BAIRRO = '&cGetBairro' and BRASIL.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL1 WHERE BRASIL1.CON_NOME = '&cGetNome' and BRASIL1.CON_BAIRRO = '&cGetBairro' and BRASIL1.CON_UF= '&cGetUf' UNION SELECT * FROM BRASIL2 WHERE BRASIL2.CON_NOME = '&cGetNome' and BRASIL2.CON_BAIRRO = '&cGetBairro' and BRASIL2.CON_UF= '&cGetUf' UNION SELECT * FROM SPC WHERE SPC.CON_NOME = '&cGetNome' and SPC.CON_BAIRRO = '&cGetBairro' and SPC.CON_UF= '&cGetUf' order by 2"
endif

// CODIGO 1-0-1-0
if !Empty ( cGetNome ) .and. Empty ( cGetBairro ) .and. !Empty ( cGetCidade ) .and. Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_NOME = '&cGetNome'  and CONSULTA.CON_CIDADE = '&cGetCidade' UNION SELECT * FROM CONSULTA1 WHERE CONSULTA1.CON_NOME = '&cGetNome' and CONSULTA1.CON_CIDADE = '&cGetCidade' UNION SELECT * FROM BRASIL WHERE BRASIL.CON_NOME = '&cGetNome' and BRASIL.CON_CIDADE = '&cGetCidade' UNION SELECT * FROM BRASIL1 WHERE BRASIL1.CON_NOME = '&cGetNome' and BRASIL1.CON_CIDADE = '&cGetCidade' UNION SELECT * FROM BRASIL2 WHERE BRASIL2.CON_NOME = '&cGetNome' and BRASIL2.CON_CIDADE = '&cGetCidade' UNION SELECT * FROM SPC WHERE SPC.CON_NOME = '&cGetNome' and SPC.CON_CIDADE = '&cGetCidade' order by 2"
endif




// CODIGO 0-1-0-0
if Empty ( cGetNome ) .and. !Empty ( cGetBairro ) .and. Empty ( cGetCidade ) .and. Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_BAIRRO = '&cGetBairro' UNION select * from CONSULTA1 WHERE CONSULTA1.CON_BAIRRO = '&cGetBairro' UNION select * from BRASIL WHERE BRASIL.CON_BAIRRO = '&cGetBairro' UNION select * from BRASIL1 WHERE BRASIL1.CON_BAIRRO = '&cGetBairro' UNION select * from BRASIL2 WHERE BRASIL2.CON_BAIRRO = '&cGetBairro' UNION select * from SPC WHERE SPC.CON_BAIRRO = '&cGetBairro' order by 5 "
endif

// CODIGO 0-1-1-0
if Empty ( cGetNome ) .and. !Empty ( cGetBairro ) .and. !Empty ( cGetCidade ) .and. Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_BAIRRO = '&cGetBairro' and CONSULTA.CON_CIDADE = '&cGetCidade' UNION select * from CONSULTA1 WHERE CONSULTA1.CON_BAIRRO = '&cGetBairro' and CONSULTA1.CON_CIDADE = '&cGetCidade' UNION select * from BRASIL WHERE BRASIL.CON_BAIRRO = '&cGetBairro' and BRASIL.CON_CIDADE = '&cGetCidade' UNION select * from BRASIL1 WHERE BRASIL1.CON_BAIRRO = '&cGetBairro' and BRASIL1.CON_CIDADE = '&cGetCidade' UNION select * from BRASIL2 WHERE BRASIL2.CON_BAIRRO = '&cGetBairro' and BRASIL2.CON_CIDADE = '&cGetCidade' UNION select * from SPC WHERE SPC.CON_BAIRRO = '&cGetBairro' and SPC.CON_CIDADE = '&cGetCidade' order by 5"
endif

// CODIGO 0-1-1-1
if Empty ( cGetNome ) .and. !Empty ( cGetBairro ) .and. !Empty ( cGetCidade ) .and. !Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_BAIRRO = '&cGetBairro' and CONSULTA.CON_CIDADE = '&cGetCidade' and CONSULTA.CON_UF= '&cGetUf' UNION select * from CONSULTA1 WHERE CONSULTA1.CON_BAIRRO = '&cGetBairro' and CONSULTA1.CON_CIDADE = '&cGetCidade' and CONSULTA1.CON_UF= '&cGetUf' UNION select * from BRASIL WHERE BRASIL.CON_BAIRRO = '&cGetBairro' and BRASIL.CON_CIDADE = '&cGetCidade' and BRASIL.CON_UF= '&cGetUf' UNION select * from BRASIL1 WHERE BRASIL1.CON_BAIRRO = '&cGetBairro' and BRASIL1.CON_CIDADE = '&cGetCidade' and BRASIL1.CON_UF= '&cGetUf' UNION select * from BRASIL2 WHERE BRASIL2.CON_BAIRRO = '&cGetBairro' and BRASIL2.CON_CIDADE = '&cGetCidade' and BRASIL2.CON_UF= '&cGetUf' UNION select * from SPC WHERE SPC.CON_BAIRRO = '&cGetBairro' and SPC.CON_CIDADE = '&cGetCidade' and SPC.CON_UF= '&cGetUf' order by 5"
endif

// CODIGO 0-1-0-1
if Empty ( cGetNome ) .and. !Empty ( cGetBairro ) .and. Empty ( cGetCidade ) .and. !Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_BAIRRO = '&cGetBairro' and CONSULTA.CON_UF= '&cGetUf' UNION select * from CONSULTA1 WHERE CONSULTA1.CON_BAIRRO = '&cGetBairro' and CONSULTA1.CON_UF= '&cGetUf' UNION select * from BRASIL WHERE BRASIL.CON_BAIRRO = '&cGetBairro' and BRASIL.CON_UF= '&cGetUf' UNION select * from BRASIL1 WHERE BRASIL1.CON_BAIRRO = '&cGetBairro' and BRASIL1.CON_UF= '&cGetUf' UNION select * from BRASIL2 WHERE BRASIL2.CON_BAIRRO = '&cGetBairro' and BRASIL2.CON_UF= '&cGetUf' UNION select * from SPC WHERE SPC.CON_BAIRRO = '&cGetBairro' and SPC.CON_UF= '&cGetUf' order by 5"
endif



// CODIGO 0-0-1-0-
if Empty ( cGetNome ) .and. Empty ( cGetBairro ) .and. !Empty ( cGetCidade ) .and. Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_CIDADE = '&cGetCidade' UNION select * from CONSULTA1 WHERE CONSULTA1.CON_CIDADE = '&cGetCidade' UNION select * from BRASIL WHERE BRASIL.CON_CIDADE = '&cGetCidade' UNION select * from BRASIL1 WHERE BRASIL1.CON_CIDADE = '&cGetCidade' UNION select * from BRASIL2 WHERE BRASIL2.CON_CIDADE = '&cGetCidade' UNION select * from SPC WHERE SPC.CON_CIDADE = '&cGetCidade' order by 7"
endif

// CODIGO 0-0-1-1
if Empty ( cGetNome ) .and. Empty ( cGetBairro ) .and. !Empty ( cGetCidade ) .and. !Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_CIDADE = '&cGetCidade' and CONSULTA.CON_UF = '&cGetUf' UNION select * from CONSULTA1 WHERE CONSULTA1.CON_CIDADE = '&cGetCidade' and CONSULTA1.CON_UF = '&cGetUf' UNION select * from BRASIL WHERE BRASIL.CON_CIDADE = '&cGetCidade' and BRASIL.CON_UF = '&cGetUf' UNION select * from BRASIL1 WHERE BRASIL1.CON_CIDADE = '&cGetCidade' and BRASIL1.CON_UF = '&cGetUf' UNION select * from BRASIL2 WHERE BRASIL2.CON_CIDADE = '&cGetCidade' and BRASIL2.CON_UF = '&cGetUf' UNION select * from SPC WHERE SPC.CON_CIDADE = '&cGetCidade' and SPC.CON_UF = '&cGetUf' order by 7"
endif


// CODIGO 0-0-0-1
if Empty ( cGetNome ) .and. Empty ( cGetBairro ) .and. Empty ( cGetCidade ) .and. !Empty ( cGetUf )
   csql := "select * from CONSULTA WHERE CONSULTA.CON_UF = '&cGetUf' UNION select * from CONSULTA1 WHERE CONSULTA1.CON_UF = '&cGetUf' UNION select * from BRASIL WHERE BRASIL.CON_UF = '&cGetUf' UNION select * from BRASIL1 WHERE BRASIL1.CON_UF = '&cGetUf' UNION select * from BRASIL2 WHERE BRASIL2.CON_UF = '&cGetUf' UNION select * from SPC WHERE SPC.CON_UF = '&cGetUf' order by 8"
endif



MAIN.StatusBar.Item(1) := ' Aguarde...... Localizando Registros... Podendo Demorar... '
WAIT WINDOW "Aguarde..... Localizando Registros... Podendo Demorar..."  NOWAIT

Try
 ret:=FDB:Execute(csql)
Catch e
 Error Connection FDB
 Return
End

if !ret:eof()

   while !ret:eof()
       
      nRecCountB++
       
     _cpf:=ret:fields["CON_CPFCNPJ"]:VALUE
     _nom:=ret:fields["CON_NOME"]:VALUE
     _end:=ret:fields["CON_ENDERECO"]:VALUE
     _bai:=ret:fields["CON_BAIRRO"]:VALUE
     _cep:=ret:fields["CON_CEP"]:VALUE
     _cid:=ret:fields["CON_CIDADE"]:VALUE
     _uf:=ret:fields["CON_UF"]:VALUE
     _dt:=ret:fields["CON_DATANASCIMENTO"]:VALUE
     _tel:=ret:fields["CON_FONE"]:VALUE
     _comp:=ret:fields["CON_COMPLEMENTO"]:VALUE
     _mae:=ret:fields["CON_MAE"]:VALUE
     
    if !empty (_dt) 
      _dt1   = dtoc(_dt)
    endif
    
    
    if empty (_dt) 
       _dt1   = _dt
    endif
  
     add item { _cpf, _nom, _end, _bai, _cep, _cid, _uf, _dt1, _tel, _comp, _mae } to grid_1 of MAIN 
     
     ret:movenext()
   enddo
    
  WAIT CLEAR  
  
  MAIN.StatusBar.Item(1) := AllTrim(Str(nRecCountB)) + ' - Registros Localizados com Sucesso !!! Para Gravar em Arquivo, Clique no Botao Exportar.'
  
  v_timefim   := time()
   
  MsgInfo( AllTrim(Str(nRecCountB)) + ' - Registros   Localizados   com   Sucesso !!!   ' + Chr(13) +        ' Para Gravar em Arquivo, Clique no Botao Exportar.' + Chr(13) + Chr(13) + 'Hora Inicial: ' + v_timeInicio + Chr(13) + 'Hora Final  : ' + v_timeFim ,[Registros Localizados])
  
   MAIN.grid_1.enabled:=.t.
   MAIN.grid_1.value:=1
   MAIN.grid_1.refresh
   MAIN.GetCpf.setfocus
   
else
   
    MAIN.StatusBar.Item(1) := AllTrim(Str(nRecCountB)) + ' - Registros Localizados   .'
    WAIT CLEAR
    msgstop('Pesquisa nao Localizada!', 'Atencao!')
   
   
endif

RETU

*------------------------------------------------------------------------------*
*                    FUNCAO BOTAO PASTA DE ARQUIVOS
*------------------------------------------------------------------------------* 

Function Pasta()

SET DEFAULT TO "_PastaArq"

DirMake(_PastaArq)

RUN Explorer "&_PastaArq"

SET DEFAULT TO "&_Pasta"


Return

Bloquear Textbox no Preenchimento de Outra

Enviado: 17 Nov 2013 12:33
por Mario Mesquita
Olá!

Talvez usando os eventos OnChange ou OnGotFocus, voce pode ativar uma função para mudar o status dessa propriedade.

Nem sempre dá certo, por experiência. É o caso de tentar e ver se funciona.

Sds.