cs_JeffC1977
Messages postés
928
Date d'inscription
vendredi 10 novembre 2000
Statut
Membre
Dernière intervention
23 septembre 2023
4
26 août 2005 à 14:04
Salut... Alors mon Bouton Retour doit etre en premier plan lorsque je clique sur optChertsey ou optKilkenny ou optWexford
sinon on ne le voit pas.....
Mes 3 frames frmKilenny, frm Chertsey et frm Wexford sont tous placé au départ à côté du frame principale (frmParoisse). Donc quand je fais un clique sur, par exemple optChertsey alors le frame se déplace au bon endroit (sur le frmParoisse) et devrait faire apparaite le bouton Retour par dessus ces frames...
Voici le code en entier....
merci d'avance
Option Explicit
Dim Connection As New ADODB.Connection
Dim BD As New ADODB.Recordset
Dim BD2 As New ADODB.Recordset
Dim strRechercheFolio As Integer
Dim OuvertureTIF As Variant
'Variable pour la boulce
'*******************************
Dim strBoucle As Integer '*
Dim Repertoire As String '*
Dim Fichier As String '*
'*******************************
' Cette déclaration est utilisée afin de faire fonctionner le ShellExecute
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Const SW_SHOWNORMAL = 1
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
'Est utilisé pour fermer le programme
Dim F As Form
For Each F In Forms
Unload F
Next
End Sub
Private Sub Form_Load()
'Type de bases de donnée pour la connexion (Pour Acces 2000 (4.0), pour la version 95 et 97 (3.51)
Connection.Provider = "Microsoft.jet.OLEDB.4.0"
'Chemin de la base de donnée (APP.PATH permet de ce mettre dans le chemin
'courant la ou ce trouve le projet)- Paramettrage de la chaine de connection
Connection.ConnectionString = App.Path & "\FOLIO_RENO.mdb"
'Ouverture de la connection
Connection.Open
'Ouverture de la requête sql dans le recordset
BD.Open "Select * from FOLIO_CADASTRE", Connection, adOpenDynamic, adLockOptimistic
Me.Show
txtRecherche.SetFocus
End Sub
'Est utiliser afin de faire fonctionner la Recherche SQL du Bouton Recherche
'le TXTVersSQL format le text en SQL
Function TXTVersSQL(message As String) As String
message = Replace(message, "'", "''")
TXTVersSQL = "'" & message & "'"
End Function
Private Sub cmdRecherche_Click()
Dim supression As Variant
If optAlexis.Value False And optEsprit.Value False And optJacques.Value = False And optJulienne.Value = False And optSalome.Value = False And optChertsey.Value = False And optKilkenny.Value = False And optWexford.Value = False Then
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Faire une Sélection!"
GoTo Absent
End If
'***************************************************************************************************
'PAROISSE
If optAlexis.Value True Or optEsprit.Value True Or optJacques.Value = True Or optJulienne.Value = True Or optSalome.Value = True Then
Set BD2 = New ADODB.Recordset
BD2.Open "SELECT * FROM [FOLIO_CADASTRE] WHERE [cad] = " & TXTVersSQL(txtRecherche.Text) & " AND [nomcad] = " & TXTVersSQL(txtParoisse.Text), Connection, adOpenKeyset, adLockBatchOptimistic
'BD2.Open "SELECT * FROM [FOLIO_CADASTRE] WHERE [cad] like '" & txtRecherche.Text & "' AND [nomcad] like '" & txtParoisse.Text & "'", Connection, adOpenKeyset, adLockBatchOptimistic
'BD2.Open "SELECT * FROM [GES_TEMPS] WHERE [DOSSIER] like '%" & txtRecherche.Text & "%' AND [EMPLOYER] like '" & ListTempsEmployesRecherche.Text & "'", Connection, adOpenKeyset, adLockBatchOptimistic
'Where cad Like '1' renverra lenregistrement qui contient le caractère 1
'Where cad Like '%1%' renverra tous les enregistrements qui contiennent le caractère 1
'Where cad Like '1%' renverra tous les enregistrements qui commencent par le caractère 1
'Where cad Like '%1' renverra tous les enregistrements qui finissent par le caractère 1
'Code qu'il y avait auparavant
'BD2.Open "SELECT * FROM [FOLIO_CADASTRE] WHERE [cad] like '%" & txtRecherche.Text & "'%", Connection, adOpenKeyset, adLockBatchOptimistic
If BD2.RecordCount <> 0 Then
txtFolio.Text = BD2!folio & ""
txtLot.Text = BD2!cad & ""
Else
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Lot Absent!"
GoTo Absent
End If
If optJulienne.Value = True Then
Repertoire = "M:\Recherches_BPD\PLAN\STE-JULIENNE"
If txtFolio < 1000 Then
For strRechercheFolio = txtFolio.Text To 1 Step -1 'Dans une Boucle, la variable doit être INTEGER
txtFolio.Text = strRechercheFolio
Fichier = Repertoire & "1680_0" & strRechercheFolio & ".tif"
If Dir(Fichier) <> "" Then Exit For
Next
If strRechercheFolio > 0 Then
OuvertureTIF = ShellExecute(Me.hWnd, "open", Fichier, vbNullString, "", SW_SHOWNORMAL)
Else
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Problème à l'exécution!"
End If
Else
For strRechercheFolio = txtFolio.Text To 1 Step -1 'Dans une Boucle, la variable doit être INTEGER
txtFolio.Text = strRechercheFolio
Fichier = Repertoire & "1680_" & strRechercheFolio & ".tif"
If Dir(Fichier) <> "" Then Exit For
Next
If strRechercheFolio > 0 Then
OuvertureTIF = ShellExecute(Me.hWnd, "open", Fichier, vbNullString, "", SW_SHOWNORMAL)
Else
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Problème à l'exécution!"
End If
End If
End If
If optAlexis.Value = True Then
Repertoire = "M:\Recherches_BPD\PLAN\ST-ALEXIS"
For strRechercheFolio = txtFolio.Text To 1 Step -1 'Dans une Boucle, la variable doit être INTEGER
txtFolio.Text = strRechercheFolio
Fichier = Repertoire & "1640_0" & strRechercheFolio & ".tif"
If Dir(Fichier) <> "" Then Exit For
Next
If strRechercheFolio > 0 Then
OuvertureTIF = ShellExecute(Me.hWnd, "open", Fichier, vbNullString, "", SW_SHOWNORMAL)
Else
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Problème à l'exécution!"
End If
End If
End If
If optEsprit.Value = True Then
Repertoire = "M:\Recherches_BPD\PLAN\SAINT-ESPRIT"
For strRechercheFolio = txtFolio.Text To 1 Step -1 'Dans une Boucle, la variable doit être INTEGER
txtFolio.Text = strRechercheFolio
Fichier = Repertoire & "1660_0" & strRechercheFolio & ".tif"
If Dir(Fichier) <> "" Then Exit For
Next
If strRechercheFolio > 0 Then
OuvertureTIF = ShellExecute(Me.hWnd, "open", Fichier, vbNullString, "", SW_SHOWNORMAL)
Else
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Problème à l'exécution!"
End If
End If
If optJacques.Value = True Then
Repertoire = "M:\Recherches_BPD\PLAN\ST-JACQUES"
For strRechercheFolio = txtFolio.Text To 1 Step -1 'Dans une Boucle, la variable doit être INTEGER
txtFolio.Text = strRechercheFolio
Fichier = Repertoire & "1610_0" & strRechercheFolio & ".tif"
If Dir(Fichier) <> "" Then Exit For
Next
If strRechercheFolio > 0 Then
OuvertureTIF = ShellExecute(Me.hWnd, "open", Fichier, vbNullString, "", SW_SHOWNORMAL)
Else
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Problème à l'exécution!"
End If
End If
If optSalome.Value = True Then
Repertoire = "M:\Recherches_BPD\PLAN\STE-MARIE-SALOME"
For strRechercheFolio = txtFolio.Text To 1 Step -1 'Dans une Boucle, la variable doit être INTEGER
txtFolio.Text = strRechercheFolio
Fichier = Repertoire & "1600_0" & strRechercheFolio & ".tif"
If Dir(Fichier) <> "" Then Exit For
Next
If strRechercheFolio > 0 Then
OuvertureTIF = ShellExecute(Me.hWnd, "open", Fichier, vbNullString, "", SW_SHOWNORMAL)
Else
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Problème à l'exécution!"
End If
End If
'****************************************************************************************************»
If optChertsey.Value True Or optKilkenny.Value True Or optWexford.Value = True Then
'****************************************************************************************************»
'CANTON
Set BD2 = New ADODB.Recordset
BD2.Open "SELECT * FROM [FOLIO_CADASTRE] WHERE [cad] like '" & txtRecherche.Text & "%' AND [dessec] like '%" & txtRang.Text & "%'", Connection, adOpenKeyset, adLockBatchOptimistic
'BD2.Open "SELECT * FROM [GES_TEMPS] WHERE [DOSSIER] like '%" & txtRecherche.Text & "%' AND [EMPLOYER] like '%" & ListTempsEmployesRecherche.Text & "%'", Connection, adOpenKeyset, adLockBatchOptimistic
'Where cad Like '1' renverra lenregistrement qui contient le caractère 1
'Where cad Like '%1%' renverra tous les enregistrements qui contiennent le caractère 1
'Where cad Like '1%' renverra tous les enregistrements qui commencent par le caractère 1
'Where cad Like '%1' renverra tous les enregistrements qui finissent par le caractère 1
'Code qu'il y avait auparavant
'BD2.Open "SELECT * FROM [FOLIO_CADASTRE] WHERE [cad] like '%" & txtRecherche.Text & "'%", Connection, adOpenKeyset, adLockBatchOptimistic
If BD2.RecordCount <> 0 Then
txtFolio.Text = BD2!folio & ""
txtLot.Text = BD2!cad & ""
Else
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Lot Absent!"
GoTo Absent
End If
If optKilkenny.Value = True Then
Repertoire = "M:\Recherches_BPD\PLAN\Kilkenny"
For strRechercheFolio = txtFolio.Text To 1 Step -1 'Dans une Boucle, la variable doit être INTEGER
txtFolio.Text = strRechercheFolio
Fichier = Repertoire & strRechercheFolio & ".tif"
If Dir(Fichier) <> "" Then Exit For
Next
If strRechercheFolio > 0 Then
OuvertureTIF = ShellExecute(Me.hWnd, "open", Fichier, vbNullString, "", SW_SHOWNORMAL)
Else
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Problème à l'exécution!"
End If
End If
If optChertsey.Value = True Then
Timer1.Enabled = True
Timer1.Interval = 2000
lblTimer.Caption = "Plan non numérisé!"
End If
End If
txtRecherche.SetFocus
Absent:
txtRecherche.SetFocus
End Sub
Private Sub form_Activate()
'Chargement des textbox a l'activation de la Form
Set txtFolio.DataSource = BD
txtFolio.DataField = "folio"
Set txtLot.DataSource = BD
txtLot.DataField = "cad"
txtFolio.Text = ""
txtLot.Text = ""
End Sub
Private Sub cmdESC_Click()
txtLot.Text = ""
txtFolio.Text = ""
txtRecherche.Text = ""
frmKilkenny.Visible = False
frmChertsey.Visible = False
frmWexford.Visible = False
optKilkenny.Value = False
optJulienne.Value = False
optWexford.Value = False
End Sub
Private Sub optAlexis_Click()
txtRecherche.SetFocus
txtParoisse.Text = "Paroisse de Saint-Alexis"
End Sub
Private Sub optChertsey_Click()
txtRecherche.SetFocus
txtParoisse.Text = "Canton de Chertsey"
frmChertsey.Visible = True
frmChertsey.Left = 90
frmChertsey.Top = 1980
frmKilkenny.Visible = False
frmWexford.Visible = False
cmdRetour.Visible = True
cmdRetour.ZOrder 0
End Sub
Private Sub optChertseyRang1_Click()
txtRang.Text = "R01"
txtRecherche.SetFocus
End Sub
Private Sub optChertseyRang2_Click()
txtRang.Text = "R02"
txtRecherche.SetFocus
End Sub
Private Sub optChertseyRang3_Click()
txtRang.Text = "R03"
txtRecherche.SetFocus
End Sub
Private Sub optChertseyRang4_Click()
txtRang.Text = "R04"
txtRecherche.SetFocus
End Sub
Private Sub optChertseyRang5_Click()
txtRang.Text = "R05"
txtRecherche.SetFocus
End Sub
Private Sub optChertseyRang6_Click()
txtRang.Text = "R06"
txtRecherche.SetFocus
End Sub
Private Sub optChertseyRang7_Click()
txtRang.Text = "R07"
txtRecherche.SetFocus
End Sub
Private Sub optEsprit_Click()
txtRecherche.SetFocus
txtParoisse.Text = "Paroisse de Saint-Esprit"
End Sub
Private Sub optJacques_Click()
txtRecherche.SetFocus
txtParoisse.Text = "Paroisse de Saint-Jacques-de-l'Achigan"
End Sub
Private Sub optJulienne_Click()
txtRecherche.SetFocus
txtParoisse.Text = "Paroisse de Sainte-Julienne"
End Sub
Private Sub optKilkenny_Click()
txtRecherche.SetFocus
txtParoisse.Text = "Canton de Kilkenny"
frmKilkenny.Visible = True
frmKilkenny.Left = 90
frmKilkenny.Top = 1980
frmChertsey.Visible = False
frmWexford.Visible = False
cmdRetour.Visible = True
cmdButton.ZOrder 0
End Sub
Private Sub optKilkennyRang10_Click()
txtRang.Text = "R10"
txtRecherche.SetFocus
End Sub
Private Sub optKilkennyRang11_Click()
txtRang.Text = "R11"
txtRecherche.SetFocus
End Sub
Private Sub optKilkennyRang8_Click()
txtRang.Text = "R08"
txtRecherche.SetFocus
End Sub
Private Sub optKilkennyRang9_Click()
txtRang.Text = "R09"
txtRecherche.SetFocus
End Sub
Private Sub optSalome_Click()
txtRecherche.SetFocus
txtParoisse.Text = "Paroisse de Sainte-Marie-Salomé"
End Sub
Private Sub optWexford_Click()
cmdRetour.Visible = True
cmdRetour.ZOrder 0
txtRecherche.SetFocus
txtParoisse.Text = "Canton de Wexford"
frmWexford.Left = 90
frmWexford.Top = 1980
frmWexford.Visible = True
frmKilkenny.Visible = False
frmChertsey.Visible = False
End Sub
Private Sub optWexfordRang1_Click()
txtRang.Text = "R01"
txtRecherche.SetFocus
End Sub
Private Sub optWexfordRang2_Click()
txtRang.Text = "R02"
txtRecherche.SetFocus
End Sub
Private Sub optWexfordRang3_Click()
txtRang.Text = "R03"
txtRecherche.SetFocus
End Sub
Private Sub optWexfordRang4_Click()
txtRang.Text = "R04"
txtRecherche.SetFocus
End Sub
Private Sub optWexfordRang5_Click()
txtRang.Text = "R05"
txtRecherche.SetFocus
End Sub
Private Sub optWexfordRang6_Click()
txtRang.Text = "R06"
txtRecherche.SetFocus
End Sub
Private Sub Timer1_Timer()
lblTimer.Caption = ""
End Sub