Thread: SQl mailmerge.
View Single Post
  #1   Report Post  
Jørgen Bondesen
 
Posts: n/a
Default SQl mailmerge.

Hi NG

I have a *.csv mergefile with fieldname: 'Products'

In this field the following words can occur: MP3, MP3_Phone, Phone, CD_MP3

I wish, to mailmerge all records where the word MP3 occur in the
text-string.

I have tried belowed:

Const mergeType01 As String = "MP3"

Const mergeType02 As String = "MP3_Phone"

Const mergeType03 As String = "CD_MP3"



'Do not function: instr
'Products, Products will give all records (test)
Dim strsql As String
strsql = "SELECT * FROM" & MyPath & " \ " & MyFile _
& "WHERE" & (InStr(1, Products, Products, vbTextCompare) 0)"


'Do not function: joker
strsql = "SELECT * FROM" & MyPath & " \ " & MyFile _
& "WHERE(Products = '*" & mergeType01 & "*')"



'This is okay:
'This solution demands programming before new word, and this is
unfortunately not good.

strsql = "SELECT * FROM" & MyPath & " \ " & MyFile _
& "WHERE (Products = '" & mergeType01 & "')" 'continue with: or


I will appreciate any suggestion?
Notice: It is not possible to split the csv-file.

Best regards
Joergen Bondesen