1

I want to get the value (T28200006) from Range("C6").

I get this error:

enter image description here

Public Sub INFO_PROTO1(ByRef strQ As String)

Dim RECSET As New ADODB.Recordset, numero_de_police

If Len(numero_de_police) > 0 Then
    RECSET.Open " select sousc.is_produit as b_perf_cma from db_dossier sousc,db_produit prod, db_protocole proto" & _
        " where sousc.no_police = " & numero_de_police & "  and sousc.cd_dossier = 'SOUSC' and " & _
        " sousc.lp_etat_doss not in ('ANNUL','A30','IMPAY') and sousc.is_produit = prod.is_produit  ", cnn_Pegase, adOpenDynamic, adLockBatchOptimistic
    
    With Worksheets("1 - Feuille de Suivi Commercial").Range("Calcul_CMA_Origine")
Community
  • 1
  • 1
VBA_Anne_Marie
  • 373
  • 3
  • 15

1 Answers1

2

Your query value is not a number, so you need to quote it in your SQL:

..." where sousc.no_police = '" & numero_de_police & "'  and...
Tim Williams
  • 154,628
  • 8
  • 97
  • 125