Marshall Barton wrote:
> Matthew DeAngelis wrote:
>
> > I have been working on this problem for several days now, using the
> > reference materials I have, and I have not been able to come up
> > with a solution. It is probably something very easy that I have
> > missed.
> >
> > I have some code that will, for each record, check several fields
> > and, if they are not null, insert the field name and its value (ie
> > 'Technology: ' & [Technology] plus two carriage returns) into the
> > field I am using to concatenate them all. This is what I have:
> [snip]
> > strCMC = strCMC & "'Technology: ' & rst!Technology & Chr(13) &
> > Chr(10) & Chr(13) & Chr(10) & """
> [snip]
> > It mostly does what it is supposed to do: if there is information
> > in a field, it inserts the string I have built. The problem is
> > that it is literally inserting the string - 'Technology: ' &
> > rst!Technology & Chr(13) & Chr(10) & Chr(13) & Chr(10) - instead of
> > evaluating it and placing the data in the field.
>
>
> You've got to many quotes, try this:
>
> strCMC = strCMC & "Technology: " & rst!Technology _
> & Chr(13) & Chr(10) & Chr(13) & Chr(10)
>
> Note that in VBA you can use the built-in constant vbCrLf
> (or vbNewLine) intead of the two Chrs. Not important, but
> it might make your code a little more readable.
That works exactly as intended, both for the quotations and the newline
constants. Thank you very much
Matt