Postada em 10/05/2006 17:46 hs
Korn,
No Form eu carrego um MSHFlexGrid com esse codigo:
M1.Clear cnnpetro.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "SoftCalSOFTCAL.mdb"
rstpetro.Open "select a.*,b.* from INSTRUMENTOS a, CERTIFICADOS b Where a.KEYINS = b.INSCTF AND (DTCCTF >=#" & Format(DTini.Value, "mm/dd/yyyy") & "# AND DTCCTF<=#" & Format(DTfim.Value, "mm/dd/yyyy") & "# AND PTFINS Like '%" & plat & "%')order by KEYINS, DTCCTF DESC", cnnpetro, adOpenKeyset, adLockOptimistic
While Not rstpetro.EOF .AddItem "" .TextMatrix(i, 0) = rstpetro!KEYINS ' Key
Select Case rstpetro!PTFINS ' Plataforma Case 1 .TextMatrix(i, 1) = "PVM-1" Case 3 .TextMatrix(i, 1) = "PVM-2" Case 4 .TextMatrix(i, 1) = "PVM-3" Case 5 .TextMatrix(i, 1) = "PCP-1/3" Case 6 .TextMatrix(i, 1) = "PCP-2" Case 7 .TextMatrix(i, 1) = "PGP-1" Case 8 .TextMatrix(i, 1) = "PPG-1" End Select
.TextMatrix(i, 2) = rstpetro!TAGINS ' TAG .TextMatrix(i, 3) = rstpetro!SERINS ' Número de Série '.TextMatrix(i, 3) = rstpetro!DESINS .TextMatrix(i, 4) = rstpetro!FABINS ' Fabricante .TextMatrix(i, 5) = rstpetro!LOCINS ' Localização .TextMatrix(i, 6) = rstpetro!MODINS ' Modelo '.TextMatrix(i, 5) = rstpetro!CTFINS 'Último certificado de calibração .TextMatrix(i, 7) = rstpetro!CODCTF 'Código do Certificado de calibração .TextMatrix(i, 8) = rstpetro!DTCCTF 'Data da calibração
rstpetro.MoveNext i = i + 1 Wend .Rows = rstpetro.RecordCount + 1 End With
rstpetro.Close cnnpetro.Close
Ou seja substituo no carregamento do Grid
E uso esse codigo no active reports:
cnnpetro.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "SoftCalSOFTCAL.mdb" Data1.ConnectionString = cnnpetro
Data1.Source = "select a.*, b.* from INSTRUMENTOS a, CERTIFICADOS b Where a.KEYINS = b.INSCTF AND (DTCCTF >=#" & Format(Petro.DTini.Value, "mm/dd/yyyy") & "# AND DTCCTF<=#" & Format(Petro.DTfim.Value, "mm/dd/yyyy") & "# AND PTFINS Like '%" & plat & "%')order by KEYINS, DTCCTF DESC"
Field1.DataField = "KEYINS" Field2.DataField = "PTFINS" Field3.DataField = "TAGINS" Field4.DataField = "SERINS" Field5.DataField = "FABINS" Field6.DataField = "LOCINS" Field7.DataField = "MODINS" Field8.DataField = "CODCTF" Field9.DataField = "DTCCTF"
cnnpetro.Close
No campo "PTFINS" vêm numeros que eu queria substituir pelos nome igual no MSHFlexGrid
Obrigado!
|