Código: Selecionar todos
@ 100,390 COMBOBOX T_Municipio ;
WIDTH 200 ;
ITEMS aMunicipio ;
VALUE PMunicipio ;
FONT 'Arial' SIZE 09 ;
FONTCOLOR BLACK BOLD ;
ON GOTFOCUS Le_Municipio()
Function Le_Municipio()
Local mfu:=LEFT(Frm_empresa.T_uf.displayvalue,2),VCOD:=0
Try
oUf:=CreateObject("ADODB.Recordset")
Catch e
MsgStop("Operação: "+E:operation+"-"+"Descrição: "+E:Description+chr(10)+vMat(e:Args))
Return
end
oUf:Open("SELECT codigo FROM uf WHERE uf = '"+MFU+"' ORDER BY uf",CNN,2,3)
IF oUf:Eof()
MsgStop("Erro ao Ler Uf")
RETU NIL
ELSE
vCod:=oUf:Fields["CODIGO"]:Value
ENDIF
Try
oMunicipio:=CreateObject("ADODB.Recordset")
Catch e
MsgStop("Operação: "+E:operation+"-"+"Descrição: "+E:Description+chr(10)+vMat(e:Args))
Return
end
vMunicipio:=PMunicipio:= 0
oMunicipio:Open("SELECT municipio.codigo,municipio.municipio FROM municipio where municipio.uf = "+str(Vcod,3)+" ORDER BY municipio",CNN,2,3)
Frm_Empresa.T_Municipio.deleteallitems()
aMunicipio:={}
Do While ! oMunicipio:Eof()
municipio=Strzero(oMunicipio:Fields["CODIGO"]:Value,7)+ [-]+oMunicipio:Fields["MUNICIPIO"]:Value
aadd ( aMunicipio , municipio )
oMunicipio:MoveNext()
Enddo
Retu nilpor Maligno: Mensagem editada para colocar a tag [ code ]<br>Veja como utilizar esta tag: faq.php?mode=bbcode#f2r1

