Hello,
I have this code
but I get an error : 3420 Object invalid on the line : For Each fld In tdf.Fields.
I don't understand. Also in DAO.field the 'f' is always in lower case. I think the issue comes from there. I even imported all the projectg to another file but same issue.
What is hapening there ?
I have this code
Code:
'code....
Dim tdf As DAO.TableDef
Dim fld
Set fld = New DAO.field
sql = "select * from t_import_agence"
Set rst = CurrentDb.OpenRecordset(sql)
Set tdf = CurrentDb.TableDefs("t_import_agence")
If Not rst.EOF Then
strlines = "UPDATE agence SET "
For Each fld In tdf.Fields
rst.MoveFirst
strlines = strlines & fld.name
Do While Not rst.EOF
strlines = strlines & " = CASE WHEN " & rst!agence_id & " THEN " & Nz(fld.Value, "NULL")
rst.MoveNext
Loop
strlines = strlines & " END ,"
Next fld
End If
'code...
but I get an error : 3420 Object invalid on the line : For Each fld In tdf.Fields.
I don't understand. Also in DAO.field the 'f' is always in lower case. I think the issue comes from there. I even imported all the projectg to another file but same issue.
What is hapening there ?