1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37
| Sub Compteur()
Dim unRowSet As Object, Dcm as object, Frml as object
Dim NmrPrjt as integer,Rslt as integer
Dcm = thiscomponent
Frml = Dcm.DrawPage.Forms.getByName("MainForm")
NmrPrjt = Frml.getByName("Cf_PrjPln").CurrentValue
UnRowSet=createUnoService("com.sun.star.sdb.RowSet")
With unRowSet
.DataSourceName =ConvertToUrl("/home/x66y/Bureau/Plans/Répertoire.odb")
.User = ""
.Password = ""
.CommandType = com.sun.star.sdb.CommandType.COMMAND
.Command = ("SELECT Max(LgnPln) AS NB FROM T_PrjPlnDtl where Cf_PrjPln = " & NmrPrjt)
On Error GoTo fermerConnexion
.execute
.next
Rslt="" & .Columns.getByName("NB").String
Rslt=Rslt+1
msgbox Rslt
thisComponent.DrawPage.Forms.getByName("MainForm").getByName("SubForm").getByName("SubForm_Grid").getByName("LgnPln").Text = Rslt
thisComponent.DrawPage.Forms.getByName("MainForm").getByName("SubForm").getByName("SubForm_Grid").getByName("LgnPln").Commit
suite:
On Error GoTo 0
.dispose
Exit Sub
fermerConnexion:
MsgBox(Error, 16)
Resume suite
End With
End Sub |
Partager