I'm not a programmer, just a little geek, but I'm trying to build up a vb script for a mailing software I use. It should write in the body of the email something depending on the non-numerical values present in two fields of the records of the various contacts, "company" (so, the company name) and "category". What I exactly need is that if the company name is unknown, it just writes nothing but if it is known, then if the category is VENUE, then it writes down "at " but if it is whatever else category, it writes down "with ". Here is what I'm trying but, naturally, it's not working. Thanks in advance for your help!
if Contact.Field("company") = "" Then
document.write("")
Else
if Contact.Field("category") = "VENUE" Then
document.write("at " & Contact.Field("company"))
if Contact.Field("category") = "INSTITUTION" Then
document.write("with " & Contact.Field("company"))
if Contact.Field("category") = "ASSOCIATION" Then
document.write("with " & Contact.Field("company"))
if Contact.Field("category") = "EV.ORG." Then
document.write("with " & Contact.Field("company"))
if Contact.Field("category") = "AGENCY" Then
document.write("with " & Contact.Field("company")
As Ali Sheikhpour stated in the comments,
document.writeis for displaying something in a web page, and I'm not sure that is what you want to do. If it is, then the code looks like it would work, but could be simplified:If this isn't working, I suspect you need to replace the
document.writewith something else, such as file system manipulation. Just where do you want the output to go?Also, do you really need to write nothing, or is doing nothing enough? I have no vision as to what the rest of the output is or how it should look.