Ho una maschera in cui al click di un bottone mi deve aprire un report e visualizzarmi soltanto i risultati della query
questo è il codive vba del report, ma mi da errore nella if quando gli do i comandi Me."nome campo" = rs(n).Value dicendomi che è impossibile assegnare un valore ad un oggetto
codice:
Option Explicit
Private rs As ADODB.Recordset
Private Sub Corpo_Format(Cancel As Integer, FormatCount As Integer)
Dim sSelect As String
Dim sSql As String
Dim sWhere As String
sSelect = "SELECT Clienti.Cognome, Clienti.Nome, Clienti.Città, Clienti.[Indirizzo 1], Clienti.[Telefono 1], Clienti.Cellulare From Clienti "
sWhere = "Where Clienti.Cod_Cliente Like '" & Cod_Cliente_Glo & "'" & " and Clienti.Cod_Progressivo = " & Cod_Prog_Glo
sSql = sSelect & sWhere
MsgBox sSql
Set rs = CurrentProject.Connection.Execute(sSql)
If Not IsNull(rs(0).Value) Then
Me.Cognome = rs(0).Value
Me.Nome = rs(1).Value
Me.Città = rs(2).Value
Me.Indirizzo_1 = rs(3).Value
Me.Telefono_1 = rs(4).Value
Me.Cellulare = rs(5).Value
End If
End Sub
PS: Cod_Cliente_Glo e Cod_Prog_Glo sono variabili pubbliche......MsgBox sSql è quello che mi aspetto