automaticbaby
Technical User
I have a form that has a query as the record source. The query combines about 8 tables. Some of these tables have repetative field names, like First Name, Last Name, etc. I have code to open Word and populate bookmarks in Word.
Here's the code:
The first line comes up blank (no data), the second line, which comes from the same table as the first line, has the correct data and the third line "can't find the field referred to in your expression."
It looks like I'm formatting something incorrectly, but it seems to work on some of the code, but not all of it. I'm using
.[Field Name] where there are conflicts with field names. Should it be something else? I don't open the query in the code because it's already the record source. Should I do that?
Here's the code:
Code:
.Item("NominatedPerson").Range.Text = FirstName & " " & MiddleInitial & " " & LastName
.Item("CompanyName").Range.Text = Company
.Item("NominatedPerson2").Range.Text = [NominatedPerson].[FirstName] & " " & [NominatedPerson].[MiddleInitial] & " " & [NominatedPerson].[LastName]
It looks like I'm formatting something incorrectly, but it seems to work on some of the code, but not all of it. I'm using