Ciao marco,
io ritengo che dovresti apportare le seguenti modifiche alla routine.
Nel modulo ove è inserito il CmdButton:
Private Sub Command60_Click()
Call DataReport3.DataReport3_Load
End Sub
Nel modulo del DataReport3:
codice:
Public Sub DataReport3_Load()
On Error Resume Next
Set DataReport3.DataSource = rsRecordSet2
Set DataReport3.DataSource = rsRecordSet3
Dim Mese2, Data2, Esecutore2, NFoglio2, Finalita, Descrizione2 As String
Mese2 = rsRecordSet2![Mese]
Data2 = rsRecordSet2![Data1]
Esecutore2 = rsRecordSet2![Esecutore]
NFoglio2 = rsRecordSet2![N Foglio]
Finalita = rsRecordSet3![Prodcampion]
Descrizione2 = rsRecordSet3![Descrizione]
DataReport3.Sections(1).Controls("Mese").Caption = UCase(Mese2)
DataReport3.Sections(1).Controls("Data").Caption = [Data2]
DataReport3.Sections(1).Controls("Esecutore").Caption = UCase(Esecutore2)
DataReport3.Sections(1).Controls("NFoglio").Caption = [NFoglio2]
DataReport3.Sections(3).Controls("Finalita").Caption = UCase(Finalita)
DataReport3.Sections(3).Controls("Descrizione").Caption = UCase(Descrizione2)
With Me
.Orientation = rptOrientLandscape
' Modifica secondo le tue necessità:
.TopMargin = 567
.BottomMargin = 851
.LeftMargin = 0
.RightMargin = 1134
.ReportWidth = 14000
'Centra la visualizzazione del Report:
If Me.WindowState = vbNormal Then
.Width = Screen.Width
.Height = Screen.Height
.Left = (Screen.Width - .Width) / 2
.Top = (Screen.Height - .Height) / 2
End If
End With
DataReport3.Show vbModal
End Sub
Poi, stai attento perchè in questo modo dichiari una sola variabile string (Descrizione2 As String), mentre tutte le altre sono variant. Quindi rettifica: Dim Mese2 As String, Data2 As String, ... .
Ho provato il codice in apparenza funziona (manca la connessione, ecc. ... la quale ricorda che deve essere chiusa).