Mail Merging a Random Select Query

C

Craig

I have a database of 12000 names and want to send out a letter to a random
selection of 300. I am using the following function and query:

Top Values property of a query, with a Module:

Public Function RndNum(vIgnore As Variant) As Double
Static bRnd As Boolean
If Not bRnd Then
'Initialize the random number generator once only
bRnd = True
Randomize
End If
RndNum = Rnd()
End Function

Then add a calculated field to your Query by typing

Shuffle: RndNum([fieldname])
Top Value = 300

**************

I now want to use the query to mail merge into a Word Document, but I cannot
get it to work.

I get an a message "Record 1 contained too few data fields". None of the
fields in the query apprear in the data list and all I get is two fields
named "M__" and "M__1" with no data.

I have tried this with two different random select queries, which give me
random query results but still not able to use the query to mail merge.

Any suggestions ?

Craig
 
T

Ted Allen

Hi Craig,

I believe that the problem is likely that your MSWord is
defaulting to a data connection type that doesn't work
with custom functions (OLEDB). I think that you can
solve this if you go to Tools|Options in word and select
the "Confirm Conversion on Open". Then, reconnect to
your data source. This time, you will get a choice as to
the connection method that you want to use. I think you
want to use DDE.

Hope that helps,

Ted Allen
 
K

KlausF

Hi Craig,

i got the same problem using mailmerge out of ms access. I suspect tha
it has to do something with the mdw-file.
Have you found a solution in the meantime?

Greetings
Klau


-
Klaus
 

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