views:

49

answers:

1

This is a follow-up on my previous question.

Once I got the problem with the reference sorted out, I ran into another pretty strange issue. Basically, I have the following behind a button on a form:

Dim attachmentField As DAO.Field2
attachmentField = Recordset("Att")

I have now linked the reference, placed a break point on the second line and added a watch on Recordset("Att"). When execution stops on the break point, I can see from the watch that Recordset("Att") returns a value of type Variant/Object/Field2, and the field contains pretty much what I expect it to.

But when I step over the second line (allow it to execute) the following error pops up: "Object variable or With block variable not set"

And of course attachmentField is assigned Nothing when it's done. What am I missing?

+5  A: 

You will need to use "Set" at the start of the assignment line.

Set attachmentField = Recordset("Att")

fitterStu