Code :Public Sub OpenReport(ReportName As String, _
Optional View As Integer, _
Optional FilterName As String, _
Optional WhereCondition As String, _
Optional Callform As Form, _
Optional OpenArgs As String)
On Error Resume Next
'For No data Dim loFormArray() As String
Dim loform As Form
Dim intCount As Integer
Dim intX As Integer
Application.CommandBars("Menu").Visible = False
For Each loform In Forms
If loform.Visible Then
ReDim Preserve loFormArray(intCount)
loFormArray(intCount) = loform.Name
loform.Visible = False
intCount = intCount + 1
End If
Next
DoCmd.OpenReport ReportName, View, FilterName, WhereCondition, , OpenArgs
DoCmd.Maximize
SendKeys ("z")
Reports(ReportName).Tag = "Preview"
'For Log files
Do While CurrentProject.AllReports(ReportName).IsLoaded = True
DoEvents
Loop
For intX = intCount - 1 To 0 Step -1
Forms(loFormArray(intX)).Visible = True
Next
Application.CommandBars("Menu").Visible = True
If Callform.Name <> "" Then
DoCmd.SelectObject acForm, Callform.Name
End If
If Err = 2501 Then Err.Clear
'Erreur définie par l'application ou par l'objet
End Sub
Le problème est que lorsque je souhaite réafficher le formulaire (forms.visible), il refuse de s'afficher.