O
Office Productivity Consultant
I have a client who has converted an Access 97 database to Access 2003. They
had a form that simply asked for a user id. The id is used as the criteria
value in a parameter query that the mailmerge document is associated with.
They have a form that has a command button that simply opens Word. Manually
they open the main document in Word (I know we could make this more
automatic) and the mailmerge runs against the parameter query.
The database is not split but that will be the next thing I do.
Anyway, the code that starts Word is:
Option Compare Database
Option Explicit
Private Sub Command82_Click()
On Error GoTo Err_Command82_Click
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
Exit_Command82_Click:
Exit Sub
Err_Command82_Click:
MsgBox Err.Description
Resume Exit_Command82_Click
End Sub
The problem is that when they open the Word document that will start the
mailmerge, it prompts the user for the userid number again. It is not
retaining the value from the form and passing it to the query that the
mailmerge runs. In Access and Word 97 it did.
This is not something that I created so I know that alot of best practices
were not used.
had a form that simply asked for a user id. The id is used as the criteria
value in a parameter query that the mailmerge document is associated with.
They have a form that has a command button that simply opens Word. Manually
they open the main document in Word (I know we could make this more
automatic) and the mailmerge runs against the parameter query.
The database is not split but that will be the next thing I do.
Anyway, the code that starts Word is:
Option Compare Database
Option Explicit
Private Sub Command82_Click()
On Error GoTo Err_Command82_Click
Dim oApp As Object
Set oApp = CreateObject("Word.Application")
oApp.Visible = True
Exit_Command82_Click:
Exit Sub
Err_Command82_Click:
MsgBox Err.Description
Resume Exit_Command82_Click
End Sub
The problem is that when they open the Word document that will start the
mailmerge, it prompts the user for the userid number again. It is not
retaining the value from the form and passing it to the query that the
mailmerge runs. In Access and Word 97 it did.
This is not something that I created so I know that alot of best practices
were not used.