Local Variables: Dim Sum As Integer
Local Variables: Dim Sum As Integer
Static Variables
preserves value even when a procedure ends. Static intPermanent As Integer all variables in a procedure static Static Function RunningTotal ( )
Sub Procedures
[Private | Public] [Static] Sub Procedurename [( arglist)] [ statements] End Sub
Event Procedures
write common statements in a separate procedure (general procedure) and then call them in the event procedure.
Function Procedures
Function Hypotenuse (A As Double, B As Double) As Double Hypotenuse = sqr (A^2 + B^2) End Function
Property Procedures
?
Do While... Loop
Dim number As Integer number = 1 Do While number <= 100 number = number + 1 Loop
While... Wend
Dim number As Integer number = 1 While number <=100 number = number + 1 Wend
Do...Loop While
Dim number As Long number = 0 Do number = number + 1 Loop While number < 201
Do Until...Loop
Dim number As Long number=0 Do Until number > 1000 number = number + 1 Print number Loop
The For...Next
For x = 1 To 50 Step 2 Print x Next
Exit For
Dim x As Integer Do While x < 10 Print x x=x+1 If x = 5 Then Print "The program is exited at x=5" Exit Do End If Loop
With...End With
Extracted Portion Year (Now) Month (Now) Day (Now) WeekDay (Now) Hour (Now) Minute (Now) Second (Now)
The calculation and conversion functions related to date and time functions are listed below. Function DateAdd ( ) DateDiff ( ) DatePart ( ) DateValue ( ) TimeValue ( ) DateSerial ( ) Description Returns a date to which a specific interval has been added Returns a Long data type value specifying the interval between the two values Returns an Integer containing the specified part of a given date Converts a string to a Date Converts a string to a time Returns a date for specified year, month and day
Description Returns a date to which a specific interval has been added Returns a Long data type value specifying the interval between the two values Returns an Integer containing the specified part of a given date Converts a string to a Date Converts a string to a time Returns a date for specified year, month and day
DateDiff Function
The DateDiff function returns the intervals between two dates in terms of years, months or days. The syntax for this is given below.
DateDiff (interval, date1, date2[, firstdayofweek[, firstweekofyear]])
Format Function
The format function accepts a numeric value and converts it to a string in the format specified by the format argument. The syntax for this is given below.
Format (expression[, format[, firstdayofweek[, firstweekofyear]]])
firstweekofyear