Cette action est irreversible, confirmez la suppression du commentaire ?
Signaler le commentaire
Veuillez sélectionner un problème
Nudité
Violence
Harcèlement
Fraude
Vente illégale
Discours haineux
Terrorisme
Autre
Raymond
Bonjour.
Plusieurs solutions: 1- Private Sub Commande0_Click() On Error GoTo nexistepas If CurrentData.AllTables("table1").Name = "table1" Then MsgBox "table existe" Exit Sub nexistepas: MsgBox "n'existe pas" End Sub
2- Private Sub Commande0_Click() On Error GoTo nexistepas Dim Tbl As DAO.TableDef Set Tbl = CurrentDb.TableDefs("table1") MsgBox "table existe" Set Tbl = Nothing Exit Sub nexistepas: MsgBox "n'existe pas" End Sub
3- Private Sub Commande0_Click() On Error GoTo nexistepas Dim Tbl As DAO.Recordset Set Tbl = CurrentDb.OpenRecordset("table1") MsgBox "table existe" Set Tbl = Nothing Exit Sub nexistepas: MsgBox "n'existe pas" End Sub
-- @+ Raymond Access MVP. http://access.seneque.free.fr/ http://access2003.free.fr/ http://users.skynet.be/mpfa/charte.htm pour une meilleure efficacité de tes interventions sur MPFA.
a écrit dans le message de news:077b01c396e6$258b5a80$ A l'ouverture de mon formulaire je teste l'existence d'une table temporaire pour savoir si je dois la créer ou non.
Comment ce test est il possible? Merci
Bonjour.
Plusieurs solutions:
1-
Private Sub Commande0_Click()
On Error GoTo nexistepas
If CurrentData.AllTables("table1").Name = "table1" Then MsgBox "table
existe"
Exit Sub
nexistepas:
MsgBox "n'existe pas"
End Sub
2-
Private Sub Commande0_Click()
On Error GoTo nexistepas
Dim Tbl As DAO.TableDef
Set Tbl = CurrentDb.TableDefs("table1")
MsgBox "table existe"
Set Tbl = Nothing
Exit Sub
nexistepas:
MsgBox "n'existe pas"
End Sub
3-
Private Sub Commande0_Click()
On Error GoTo nexistepas
Dim Tbl As DAO.Recordset
Set Tbl = CurrentDb.OpenRecordset("table1")
MsgBox "table existe"
Set Tbl = Nothing
Exit Sub
nexistepas:
MsgBox "n'existe pas"
End Sub
--
@+
Raymond Access MVP.
http://access.seneque.free.fr/
http://access2003.free.fr/
http://users.skynet.be/mpfa/charte.htm pour une meilleure
efficacité de tes interventions sur MPFA.
<anonymous@discussions.microsoft.com> a écrit dans le message de
news:077b01c396e6$258b5a80$a101280a@phx.gbl...
A l'ouverture de mon formulaire je teste l'existence d'une
table temporaire pour savoir si je dois la créer ou non.
Plusieurs solutions: 1- Private Sub Commande0_Click() On Error GoTo nexistepas If CurrentData.AllTables("table1").Name = "table1" Then MsgBox "table existe" Exit Sub nexistepas: MsgBox "n'existe pas" End Sub
2- Private Sub Commande0_Click() On Error GoTo nexistepas Dim Tbl As DAO.TableDef Set Tbl = CurrentDb.TableDefs("table1") MsgBox "table existe" Set Tbl = Nothing Exit Sub nexistepas: MsgBox "n'existe pas" End Sub
3- Private Sub Commande0_Click() On Error GoTo nexistepas Dim Tbl As DAO.Recordset Set Tbl = CurrentDb.OpenRecordset("table1") MsgBox "table existe" Set Tbl = Nothing Exit Sub nexistepas: MsgBox "n'existe pas" End Sub
-- @+ Raymond Access MVP. http://access.seneque.free.fr/ http://access2003.free.fr/ http://users.skynet.be/mpfa/charte.htm pour une meilleure efficacité de tes interventions sur MPFA.
a écrit dans le message de news:077b01c396e6$258b5a80$ A l'ouverture de mon formulaire je teste l'existence d'une table temporaire pour savoir si je dois la créer ou non.