Please use Code Tags when posting VBA Code (1 Viewer)

Status
Not open for further replies.

John Big Booty

AWF VIP
Local time
Today, 09:44
Joined
Aug 29, 2005
Messages
8,263
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;


Then paste your code between the two Code tags;


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

Last edited:

John Big Booty

AWF VIP
Local time
Today, 09:44
Joined
Aug 29, 2005
Messages
8,263
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 (Users: 0, Guests: 1)

Top Bottom