Please use Code Tags when posting VBA Code

Status
Not open for further replies.

John Big Booty

AWF VIP
Local time
Tomorrow, 05:24
Joined
Aug 29, 2005
Messages
8,262
To make your code easier to read, please use the Code tag around your code, this will ensure that any code you copy and paste from your DB retains it's formatting making it easier to read and follow;

Firstly click on the Code button, that's the button at the top of the posting window with the cross hatch (#) on it;
attachment.php


Then paste your code between the two Code tags;
attachment.php


and the result should look something like this;
Code:
    If DateValue(Me.Combo0.Column(2)) <= Date Then
        MsgBox "password expired"
    Else
        MsgBox "password OK"
    End If
 

Attachments

  • Capture1.PNG
    Capture1.PNG
    19.1 KB · Views: 7,615
  • Capture2.PNG
    Capture2.PNG
    40.4 KB · Views: 5,923
Last edited:
Thanks to pr2-eugin, for the following advise regarding indenting in your code;

Check out this thread.. "Please Use CODE tags when posting VBA Code"..

Also make sure you properly indent the code.. The following..
Code:
Public Function SelectAll(lst As ListBox) As Boolean
On Error GoTo Err_Handler
[COLOR=Green]'Purpose:   Select all items in the multi-select list box.
'Return:    True if successful
'Author:    Allen Browne. http://allenbrowne.com  June, 2006.[/COLOR]
Dim lngRow As Long

If lst.MultiSelect Then
For lngRow = 0 To lst.ListCount - 1
lst.Selected(lngRow) = True
Next
SelectAll = True
End If

Exit_Handler:
Exit Function

Err_Handler:
Call MsgBox(Err.Number & Chr(10) & Err.Description & Chr(10) & "SelectAll()")
Resume Exit_Handler
End Function
Is as bad as..

Public Function SelectAll(lst As ListBox) As Boolean
On Error GoTo Err_Handler
'Purpose: Select all items in the multi-select list box.
'Return: True if successful
'Author: Allen Browne. http://allenbrowne.com June, 2006.

Dim lngRow As Long

If lst.MultiSelect Then
For lngRow = 0 To lst.ListCount - 1
lst.Selected(lngRow) = True
Next
SelectAll = True
End If

Exit_Handler:
Exit Function

Err_Handler:
Call MsgBox(Err.Number & Chr(10) & Err.Description & Chr(10) & "SelectAll()")
Resume Exit_Handler
End Function

Properly indented code,
Code:
Public Function SelectAll(lst As ListBox) As Boolean
On Error GoTo Err_Handler
[COLOR=Green]    'Purpose:   Select all items in the multi-select list box.
    'Return:    True if successful
    'Author:    Allen Browne. http://allenbrowne.com  June, 2006.[/COLOR]
    Dim lngRow As Long

    If lst.MultiSelect Then
        For lngRow = 0 To lst.ListCount - 1
            lst.Selected(lngRow) = True
        Next
        SelectAll = True
    End If

Exit_Handler:
    Exit Function

Err_Handler:
    Call MsgBox(Err.Number & Chr(10) & Err.Description & Chr(10) & "SelectAll()")
    Resume Exit_Handler
End Function
 
Status
Not open for further replies.

Users who are viewing this thread

Back
Top Bottom