Re: How to continue a line -- space_underscore



Hi Nancy,

if you are breaking a string, you will need & ... but if you are not, then you won't.

Here are some examples:

'~~~~~~~~~~~~
strSQL = "SELECT email " _
& " FROM [YourTablename] " _
& " WHERE conditions " _
& " ORDER BY somefieldname;"
'~~~~~~~~~~~~

& is used because the SQL statement is one string

'~~~~~~~~~~~~
Msgbox "This is a message" _
, _
, "Here is the title"
'~~~~~~~~~~~~

& is NOT used here because the different lines are used just to make the parameters easier to follow and there is nothing that needs to be concatenated (combined)

.... it just depends on what the statement is and where you break it

'~~~~~~~~~~~~
Msgbox "This line one of a message" _
& vbCrLf & " and line 2 of the message" _
& " because vbCrLf means to add a line break" _
, _
, "Here is the title"
'~~~~~~~~~~~~

when you do break lines, remember to add the necessary spaces! I like to put & at the beginning of a line if it needs it as well as start each literal string with a space if it is a continuation


Warm Regards,
Crystal
*
(: have an awesome day :)
*
MVP Access
Remote Programming and Training
strive4peace2006 at yahoo.com
*



Nancy wrote:
Thank you. Yes that is what I meant. I realized it wasn't very detailed, so I did another post. Actually, the other response said & _ (amersand, space, underscore)
I guess I will try bother.

.



Relevant Pages

  • Re: Error using " in .open with ADODB.Recordset
    ... recordset but I'm getting hung up on the SQL statement. ... query that has a string as a condition. ... Dim mrk As String ...
    (microsoft.public.data.ado)
  • RE: Update SQL not updating ...
    ... copy/pasted it then made formatting changes and stuck in the correct criteria. ... making the sql statement correctly but it is not updating ... I am guessing it is the string within a string part. ... MsgBox (ProjectID) ...
    (microsoft.public.access.modulesdaovba)
  • Re: SQL Statement with LIKE %
    ... short string is contained within a bigger field in Access databases. ... But how would I set up the SQL statement if I was trying to find ... the vbscript code that results in the same statement. ... My real problem is that I have a string named AgentString as: ...
    (microsoft.public.inetserver.asp.general)
  • Re: Too few parameters, expected n when executing SQL from VBA
    ... desired SQL statement, either, so I suggest a completely different approach ... Public Sub TestQuery(ByVal strFieldName As String) ... Dim strSQL As String, strTemp As String ...
    (microsoft.public.access.modulesdaovba)
  • Re: Help with SQL statement
    ... > Dim Product As String, TarWgt As Double, FileNum As ... > Exit Sub ... Your SQL statement doesn't work because it is not an UPDATE you need to ... directly from the combo box's Columnto the other text boxes, ...
    (microsoft.public.access.modulesdaovba)

Loading