A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Running & Setting Up Queries
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Mail Merging a Random Select Query



 
 
Thread Tools Display Modes
  #1  
Old September 23rd, 2004, 04:22 PM
Craig
external usenet poster
 
Posts: n/a
Default 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  
Old September 24th, 2004, 04:01 PM
Ted Allen
external usenet poster
 
Posts: n/a
Default

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  
Old May 24th, 2005, 03:18 PM
KlausF
external usenet poster
 
Posts: n/a
Default


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Print 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


All times are GMT +1. The time now is 08:59 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.