First and foremost, you should not use DLookups in queries as a rule. It's inefficient but mostly it doesn't make sense when you can make the looked up field part of the query itself just by adding the table and/or field. Second, since you're using non alpha characters in your data, your field type has to be string. In that case, when you have to concatenate variables you must add quotes (single quote being the easiest). Such a lookup might then be Dlookup("accounthead","coa","accountid= ' " &[accountid] & " ' ")
I added spaces so that the quotes are easier to see. You would remove them.
I guess I should refresh my page when I've been away.
The more we hear silence, the more we begin to think about our value in this universe.
Paraphrase of Professor Brian Cox.