|  | Posted by David on 07/23/05 00:24 
I want to loop through a table (tblrelmanager) and merge the results with a
 > word doc. The trouble is I am not used to SQL coding and I cant get my
 > WHERE
 
 > statement to work.
 
 > Can anyone tell me where I am going wrong
 
 >
 
 > Thanks in advance
 
 > Dave
 
 >
 
 >
 
 >
 
 >
 
 >
 
 > Set rst = db.OpenRecordset("tblrelmanager")
 
 >
 
 > Do Until rst.EOF
 
 >
 
 > Set objWord = GetObject("N:\Customer Management Centre\Warrington\Reach
 
 > Team\Database\fire risk assessment.doc", "Word.Document")
 
 > objWord.Application.Visible = True
 
 > objWord.MailMerge.OpenDataSource _
 
 > Name:="D:\Documents and Settings\All Users\Documents\WSS\WSS.mdb", _
 
 > LinkToSource:=True, _
 
 > Connection:="table tblAccenture", _
 
 > SQLStatement:="SELECT * FROM [tblAccenture] WHERE [Relationship
 
 > Manager] = rst.[Relationship Manager]"
 
 >
 
 > objWord.MailMerge.Execute
 
 > rst.MoveNext
 
 > Loop
  Navigation: [Reply to this message] |