If "rstspain![cityname]" is a text type field, you need to use delimiters. Try:
Code:
Private Sub Command1_Click()
Dim dbs As Database
Dim rstspain As Recordset
Dim rstcity As Recordset
Set dbs = CurrentDb()
Set rstspain = dbs.OpenRecordset("Spain", dbOpenDynaset)
Set rstcity = dbs.OpenRecordset("City", dbOpenDynaset)
rstspain.MoveFirst
Do While Not rstspain.EOF
rstcity.MoveFirst
rstcity.FindFirst "[cityname] = '" & rstspain![cityname] & "'"
If rstcity.NoMatch Then
MsgBox "City " & rstspain![cityname] & " not found"
Else
rstspain.Edit
rstspain!city = rstcity!cityID
rstspain.Update
End If
rstspain.MoveNext
Loop
MsgBox "Einde"
End Sub
Exploded, the line looks like:
rstcity.FindFirst "[cityname] = ' " & rstspain![cityname] & " ' "
(but don't use with the spaces)