.


:




:

































 

 

 

 


VBA Access




VBA , . MS Office; VBA , . MS Office; Access, Word Excel. VBA.

. Access . , . . 225. Variant. ( , ) Null. , - , IsNull ().

( , ), . :

Byte Currency @
Integer % String $
Long & Date
Single! Boolean
Double # Variant

Dim.

Dim < > As < >.

, Dim i As Integer, j As Integer Dim x As Double

. Dim < > As String , Dim < > As String*< > - . :

Dim str1 As String Dim str2 As String*20.

, . Option Explicit. Access .

. :

1. . , ;

2. (). () () , () ;

3. . ;

4. . Public Global.

, , Access , . .

. . Null, 0, . , , Static. , . , . , , , . , Static.

C Dim . . :

Dim myArray(20) As String*10

Dim myArray(5, 5) As Double Dim myArray(3, 3, 3) As Double

0, , 21 , 6 6. , . , Dim my Array(1 20) As String.

VBA . , ReDim . . Preserve.

Dim dynArray() As Double

ReDim Preserve dynArray (5, 2, 4)

LBound() UBound() . Erase.

VBA Const. .

Const pi As Double = 3.1415

VBA , Access. Access , Object, . :

Dim myObject As Object ,

Dim myControl As Control ,

Dim myForm As Form .

Set.

Set myForm = Forms![ ].

. TypeEnd Type.

Type tPhone

number As String*15

type As String*10

End Type

..

Dim tel As tPhone

tel.number = 3334455

tel.type = "".

, , With End With.

Dim myForm As Form

Set myForm = Forms![ ]

With myForm

.Top=1000

.Left=1000

.Width=5000

. Height=4000

End With.

. , , .

. VBA . , Sub End Sub Function End Function. :

Sub < < [(<>)]

<>

End Sub

Function < > [(<>)] As < >

<>

< > = < >

End Function

. , . Call. , . Call. . , , . :

Call mySub("", 4, i+1)

mySub "", 4, i+1

total_price = myFunc([]*[], [])

: . ( ByRef). . . , . ByVal. BVal/ByRef < > [()] [As <un>]. :

Sub mySyb(srteet As String, ByVal building As Integer, ByRef apt As Byte)

Forms![]![] = srteet & " " & building & ", " & apt

End Sub

Function myFunc(full_price As Currency, shipment As Single) As Currency

myFunc = full_price * 1.2 + shipment

End Function

Exit Sub Exit Function.

. , ( ) . . If Select Case. If .

If <> Then <>

If :

If <> Then

<>

Else

<>

End If

If.

If <> Then

<>

Else If < 2> Then

<>

Else

<>

End If

, If Select Case End Select. , , , .

Select Case < >

Case < 1> [, < 2>, ]

(, , 1, 2, )

[Case < 3> To < 4>]

(, , , 3 4)

[Case Is < >]

(, , .)

[Case Else]

(, , )

End Select

VBA :. GoTo <>. GoTo , .

VBA : (For Next) (Do Loop).

ForNext .

For <> = < > To < > [Step <>]

<>

Next <>

Exit For.

Do While Loop, While Wend . While Wend . , True.

Do While < [=True]>

<>

Loop

Do Until Loop ,

Do Until < [< > True]>

<>

Loop

, .

Do

<>

Loop While < [=True]>

Do

<>

Loop Until < [=False]>

Exit Do.

For Each

For Each <> In <>

<>

Next <>

<> , . 1 ,

Dim ctrl As Control

For Each ctrl In Form

1.AddItem ctrl.Name

Next ctrl





:


: 2016-11-24; !; : 941 |


:

:

: , , , , .
==> ...

1698 - | 1552 -


© 2015-2024 lektsii.org - -

: 0.035 .