How can I avoid runtime error 3075 when running this Access VBA query?

Can someone please tell what is wrong with this request?

sqltext = "SELECT utyp, count(*) AS anzahl
           INTO UTYP_Anzahl FROM 01_umwelt 
           WHERE [01_umwelt].status = Me.Controls(""STATUS"").Value 
           GROUP BY utyp;"

      

I am getting runtime error 3075.

+1


source to share


1 answer


The SQL used is invalid. You should avoid the query string when adding a link to the control. Alternatively, you can get control directly by name. Try the following:



sqltext = "SELECT utyp, count(*) AS anzahl INTO UTYP_Anzahl " _
        & "FROM 01_umwelt WHERE [01_umwelt].status = " _
        & STATUS.Value _
        & " GROUP BY utyp;"

      

+4


source







All Articles