add a (visual) line break in code window

  • Thread starter Thread starter T. Tiskus
  • Start date Start date
T

T. Tiskus

Hello,

I have a longer line of code, which I can't see in my window, but if I press
return, it won't work. Isn't there some character that I can enter so that
the code will be read across two lines?

Also, I am quite a novice for coding, so if there's a more elegant way to do
this, I'm happy to get suggestions!

T. Tiskus

Here's the code -- it's the 10,20, 30 line that's the problem...

Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
If Me![txtRunningCount] = 10 Or Me![txtRunningCount] = 20 Or
Me![txtRunningCount] = 30 Or Me![txtRunningCount] = 40 Then
Me![TenLine].Visible = True
Else
Me![TenLine].Visible = False
End If
End Sub

Oh, if it's important. I'm using Access2000. Thanks!
 
Oh, if it's important. I'm using Access2000. Thanks!
Yes it is, this wasn't available before Access 2000.

Use an _ at the end of the line as a continuation character.

Example:
If Me![txtRunningCount] = 10 Or Me![txtRunningCount] = 20 Or _
Me![txtRunningCount] = 30 Or Me![txtRunningCount] = 40 Then
 
You can use a space followed by an underscore
You don't have reserve this just for long lines. It often makes your code
easier to read.

If Me![txtRunningCount] = 10 Or _
Me![txtRunningCount] = 20 Or _
Me![txtRunningCount] = 30 Or _
Me![txtRunningCount] = 40 Then
 
T:

Yes, use the underscore character for a line continuation as in:

If Me![txtRunningCount] = 10 Or _
Me![txtRunningCount] = 20 Or _
Me![txtRunningCount] = 30 Or _
Me![txtRunningCount] = 40 Then
 
Yes and no. You have to concatenate it back together again.

strMyString = "This is " & _
"a test."
 
Back
Top