Dear Loungers,
I have been converting my macros to vba. To do this I have used the Access conversion tool and then tidied things up. This is probably a dumb question I just can’t find any one source that explain the possibilities… In some cases I am getting vba statement with multiple quotation marks and I don’t now why, or if this is significant:
-
Example 1: TempVars.Add “tv_ErrorMessage”, “[TempVars]![tv_ErrorMessage] & “”Event cannot be blank. “””
in this case I can see how the last parameter has used quotation marks since the parameter is a string and that string is a concatenation of a the contents of the value of variable plus a text string; BUT as it stands [TempVars]![tv_ErrorMessage] won’t resolve to the value of the variable so I am changing it to TempVars.Add “tv_ErrorMessage”, [TempVars]![tv_ErrorMessage] & “Event cannot be blank.”
Example 2: TempVars.Add “tv_ErrorMessage”, “[TempVars]![tv_ErrorMessage] & “”you must select an Item Type “” & Chr(10)”
-
this is similar to example 1 but the last parameter is a concatenation of value of variable plus a text string plus a line feed, in this case why is the ampersand concatenating the last element inside the quotation marks around the line feed?
Example 3: TempVars.Add “tv_PER_Id”, “Null”
-
This seem quite straightforward although since Null is a keyword I am surprised it was put in quotation marks, when I ran the code the string “null” was used rather than the value Null so have changed it and I am surprised the converter got this wrong.
Example 4: TempVars.Add “tv_CurrentProcess”, “””Checkin”””
-
why is “””Checkin””” using three pairs of quotation marks instead of one like this “Checkin” which seems to work fine?
Example 5: DoCmd.OpenForm “frm_CheckIn1”, acNormal, “”, “”, acAdd, acDialog
-
is leaving the parameter with nothing between the separating commas the same as using “”? so is this statement behave exactly the same way – DoCmd.OpenForm “frm_CheckIn1”, acNormal, , , acAdd, acDialog – and must the separators have a space between them or does comma comma behave the same way as comma space comma?
[/list]
Can anyone explain what is happening and where I can find the general rules applying to the usage of quotation marks
Many thanks……………………..liz