Go Back   Access World Forums > Microsoft Access Discussion > Modules & VBA

 
Closed Thread
 
Thread Tools Rate Thread Display Modes
Old 01-18-2013, 08:42 PM   #1
John Big Booty
AWF VIP
 
John Big Booty's Avatar
 
Join Date: Aug 2005
Location: Planet 10, by way of the Eighth Dimension
Posts: 8,263
Thanks: 113
Thanked 1,011 Times in 865 Posts
John Big Booty is a jewel in the rough John Big Booty is a jewel in the rough John Big Booty is a jewel in the rough
Exclamation Please use Code Tags when posting VBA Code

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
Attached Images
File Type: png Capture1.PNG (19.1 KB, 5354 views)
File Type: png Capture2.PNG (40.4 KB, 4260 views)

__________________
...but they're only monkey boys!!!

Last edited by John Big Booty; 01-19-2013 at 11:01 AM.
John Big Booty is offline  
The Following 14 Users Say Thank You to John Big Booty For This Useful Post:
Bent2Bits (02-17-2013), Breanna (01-06-2015), garnold (02-17-2013), greenfch (03-05-2013), hassanogaibi (06-28-2016), Isskint (01-19-2013), Jalnac74 (04-05-2015), jmeni (10-11-2013), Kirkuleese (05-21-2014), krissy21 (06-12-2017), Martinchox (04-17-2015), Milad (07-15-2013), MiniD011 (03-21-2013), silversun (01-23-2013)
Old 05-16-2013, 03:20 PM   #2
John Big Booty
AWF VIP
 
John Big Booty's Avatar
 
Join Date: Aug 2005
Location: Planet 10, by way of the Eighth Dimension
Posts: 8,263
Thanks: 113
Thanked 1,011 Times in 865 Posts
John Big Booty is a jewel in the rough John Big Booty is a jewel in the rough John Big Booty is a jewel in the rough
Re: Please use Code Tags when posting VBA Code

Thanks to pr2-eugin, for the following advise regarding indenting in your code;

Quote:
Originally Posted by pr2-eugin View Post
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
'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
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
    '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
__________________
...but they're only monkey boys!!!
John Big Booty is offline  
The Following 3 Users Say Thank You to John Big Booty For This Useful Post:
Breanna (01-06-2015), hassanogaibi (06-28-2016), tyworld (11-29-2016)
Closed Thread

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Use Code Tags when posting VBA code boblarson Access FAQs 1 05-29-2015 03:54 PM
Code to divide results by units based on Site Code. jereece Reports 5 11-28-2011 02:21 PM
what code should i add to the following code to check invalid username or password varshasan VB.NET 1 04-14-2011 05:52 AM
Access Code & Module 32bit to 64bit system - Browse For File Code Thorope Modules & VBA 2 04-04-2011 09:13 AM
Code errors on converting 97 to 2003 see pasted code Scolds Modules & VBA 2 12-09-2005 03:34 AM




All times are GMT -8. The time now is 03:00 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World