If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Mail Merging a Random Select Query
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 |
#2
|
|||
|
|||
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 -----Original Message----- 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 . |
#3
|
|||
|
|||
Hi Craig, i got the same problem using mailmerge out of ms access. I suspect that it has to do something with the mdw-file. Have you found a solution in the meantime? Greetings Klaus -- KlausF ------------------------------------------------------------------------ Posted via http://www.mcse.ms ------------------------------------------------------------------------ View this thread: http://www.mcse.ms/message1091368.html |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Taher | Setting Up & Running Reports | 1 | August 31st, 2004 09:07 PM | |
Random Function in VB | Jim Campbell | New Users | 10 | August 8th, 2004 12:33 AM |
mail merging formatted content | raj | General Discussion | 6 | July 8th, 2004 11:15 AM |
query field reference help | -dch | Running & Setting Up Queries | 4 | June 2nd, 2004 07:30 PM |