add a (visual) line break in code window

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!
 
W

Wayne Morgan

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
 
D

Duane Hookom

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
 
S

SA

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
 
W

Wayne Morgan

Yes and no. You have to concatenate it back together again.

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top