Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 17th, 2005, 05:44 AM
HarryM HarryM is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 2 HarryM User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 26 m 41 sec
Reputation Power: 0
Automating Mailmerge To Existing Documents

Hi Guys

I'm having real trouble with this and hopefully you can help.
I have a requirement to set up an automated mailmerge to work from a make table query.
This query sets up a table which contains only the data to be merged at any time and it is determined by a renewal month.
However, and this is where I'm running into some problems, if the renewal is one year old, I want the merge to use 'doc1', if it's two years to
use 'Doc2' if it's older than two years to use 'Doc3' and finally (phew!!!) if it's in the current year to be ignored.
So, the three documents are already created in word and are in the same directory as the database and a basic mailmerge works but, when I
try and use a if then loop, the code starts to go funny on me in that if there is more than one branch in th eloop it doesn't seem to recognise
what I want it to do, when I try to compile the code it highlights the End Function part and says there is a block 'If' statement with no End If but there is and, of course if I replace the End Function statement it looks for that. I realise that it's more than possible that I can't do what is required but that would be okay as long as I know it can't be done.....
Also, in the if then loop, I'm trying to set up the criteria as If Year([Date]) = Year(Now())-1 etc and whgen I do this it highlights the square brackets and gives a compile error something like, unable to recognize external call....

I know I'm doing something really badly wrong here but I'm not good enough with code to know what it is, can anybody help.

Thansk in anticipation

HarryM

Reply With Quote
  #2  
Old January 17th, 2005, 08:07 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 4
HarryM,

The End If that is missing is in the procedure somewhere. The End Function is highlighted but the actual problem is somewhere in the code. Follow down each If statement carefully and you will probably find the missing End If.

As far as your If statement with the date, a couple of things. First depending on where this part of the code is placed in your procedure, you may have to show the date as a variable rather than a call. Second, I would suggest renaming the field to something other than Date. Date is an Intrinsic Constant and access may not distinguish between the constant and your field name correctly.

If you still run into problems, post your function and let us look at it.

lwells

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Automating Mailmerge To Existing Documents


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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 On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway