Compile error - help appreciated

J

James

Using Access 2000
I have used this code in other apps, but I am getting a Compile Error
in this new one.

Error is "Qualifier must be collection".

Code is:

Private Sub Command12_click()


' start Microsoft Word.
Set wordApp = CreateObject("Word.Application")

With wordApp

' Make the application visible.
.Visible = True
' Open the document.
.Documents.Open ("C:\DataLetters\NoticeToProceed.doc")
' Move to each bookmark and insert text from the form.
.ActiveDocument.Bookmarks("To").Select
.Selection.Text = (CStr(forms!NoticeToProceed!To))
.ActiveDocument.Bookmarks("From").Select
.Selection.Text = (CStr(forms!NoticeToProceed!From))
.......

And I get the error on the first .Selection.Text line where
!NoticeToProceed! is highlighted.

Any help greatly appreciated.
Thanks,
James
 
T

TC

I assume that a form called "NoticeToProceed" is open, and that is has a
control or field named "To"? If not, that is your problem.

BTW, "To" is a reserved word. It is not good as the name of a field or
control. Rename that field or control, or use the following syntax to make
your usage clear to Access:

forms!NoticeToProceed![To]

or even (my preference):

forms![NoticeToProceed]![To]

HTH,
TC
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top