in my Job I have a Little Problem with VBA (I'am new to VBA, so it is maybe only a Little fault, but I haven't found a solution in the Internet)
For i = 0 To Me!Liste_Eingangsdiagnostik.ListCount - 1
diagName = Me!Liste_Eingangsdiagnostik.column(0, i) & "_" & Me!Liste_Eingangsdiagnostik.column(1, i) & "_" & 1
If Me!Liste_Eingangsdiagnostik.Selected(i) Then
buildFilter_EingangsDiag i
tableName = Me!Liste_Eingangsdiagnostik.column(0, i)
Debug.Print tableName
newColumn = "ALTER TABLE " & tempTable & " ADD COLUMN " & tableName & " " & "Long"
Set rs = CurrentDb.OpenRecordset("abf_Export_Diagnostik") 'Erstelle die Antworten
'updateExport = "INSERT INTO Export_Hilfstabelle " & " (IDTAB_EP, ID_Antwortbogen, tableName) " & " (rs.Fields(1).Value,rs.Fields(1).Value,.Fields(1).Value)"
db.Execute newColumn
Do While Not rs.EOF
a = rs.Fields("IDTAB_EP").value
Debug.Print a
b = rs.Fields("ID_Antwortbogen").value
Debug.Print b
c = rs.Fields("strAntworten_Text").value
Debug.Print c
db.Execute "INSERT INTO [Export_Hilfstabelle] " & " ([IDTAB_EP], [ID_Antwortbogen], [ID_Frage], ['" & tableName & "']) VALUES " & " ('" & a & "', '" & b & "',0,'" & c & "')"
rs.MoveNext
Loop
End If
Next i
The Users of this Database want all their Diagnostics they choose in one Table. So I try to add for every Diagnostic a new column (tableName), but I got the ErrorLog: the field Name ist not correct. (I'm from Germany, so some Vars are in German.) Thank you very much for yout help!