You are on page 1of 23

MS Access

MS Access 47

(Tables)
1. (Primary Key) Access;

Access,
. .,
.

, .
,
, . ,
,
,
.

2. (Index) ;

,

.

, Access
,
.
. Access , ..
, , , ,
, Access
.

, Access
(no duplicates) (yes
duplicates). , ,
, ,
, , .
, , ,
.

3.
;

,
,
.
.

4. (Validation Rule) (Validation Text)


;


1
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

,
.
, Access
, .

, ,
, : >= 0 and <=20 between 0 and 20. , ,
15 17, Access.

, , /
, : or / or .

Access ,
. ,
.

,
.

5. , (Relationship)
Access;

, .
.
.

, Show Relationships
()
. , ,
. Access
1
.
(one to many).

,
<delete>, , ,
, ,
. ,
.

,
. ,
,
(ID_?ae) ,
, .

, , ..
, .. Access

.

6. (Referential Integrity);


2
PDF created with pdfFactory trial version www.pdffactory.com
MS Access


,

.

.,
, ,
.

. -,
,
, ,
. ,
,
.

, , , Access
. ,
,
, .

7. (Cascade Update);

, ,
,
.

,
,
, ,
.

8. (Cascade Delete);

, ,
,
.

,
,
, . ,
Access , .

9. (one to many);

, , ,
, .

, .

, ,
.


3
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

,
.

10. (many to many);

, , ,
, .

,
.

,
.

,
.

11. (one to one);

, , ,
, .

,
.

,
.

,
.

12. Access . , ,
, ;

,
. ,
, .

, ..
, , ,
. ,
.

13. Access . , , ,
;

, ,
-. ..
, ,
.


4
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

14. (Query);

Access ()
/ .
. .
(Select Query).

,
. , ,
100.000 .

, , . ..
/ 100.000 300.000 .

, ,
, .

15. Access ;

()
, . And
Or. And ,
Criteria.

Or Or,
Criteria. , , Criteria ,
And Or , .

.
:

LIKE

LIKE *

LIKE *

LIKE **

LIKE []*

(, /, )

Or

>20 and <40 20 40, 20 40

between 10 and 30 10 30, 10 30

<= 100 Or > 200 100 200

LIKE ??* , ,

LIKE ##00 00


5
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

LIKE [!]* ,

16. Show Access;

, Show (),
. ,
.

, , ,
;
.

:
.
LIKE . , , ,
.

, , , . ,
Show .
.

17. Totals Access;


. :
Sum (), Count (), Avg ( ), Min ( ) Max (
).

,
(Group by). Totals.

18. (Group by) Access;

, Access ,
.

, , (group by)
count .


,
sum .

19. (Action Queries);

Access
. ,
.

(Update Queries),
, (Delete Queries),
, (Add Queries),
(Make Table Queries),
.


6
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

20. Access;

Access, , ,
, ,
, .

, ,
10%,
:

[] * 1.1

,
.

, , :

[ ] + [ ] * 1.2

, , Access,
(Update Queries) (module).

(Forms)

21. Access ;

Access
(Tables) (Queries) .
(table) (query) Access
. , .
.

()
,
.

,
. ,
.

PageUp
PageDown . ,

.

, ,
(datasheet) . ,
, .

22. ;


. ,


7
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

.
, , ,
,
.

, (control box)
(ab ), : ([-1]+[-2]+...)/10,
.
, .

, .
,
. .

, , , , ,
(video) Windows .
' .


. ,
/, , ,
,
, .

, , , Access
. , ,
. , ,
.

,
,
(datasheet).

23. ;

(toolbox)
, , ,
, , , , .

Oi (properties)
, (details), ,
, .
, : Format (), Data
(), Event (), Other ( ) All ()
.

24. ;

, . , ,
: (labels) (text boxes).

(, , , ),
, ,
,
. ()
.


8
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

.
, ,
. , ,
. , ,
,
. ()
ab .

(control boxes)
.

25. (Option Group);


(option buttons),
(check boxes) (toggle buttons).
.
, O
.

,
.

.

, Telestet
, : economy, business,
city business plus. Telestet
.

, ,
, ,
,
Telestet. , ,
, .
(labels) .

26. (List Box - Combo Box);

Access
.
.

(/ - -
), . , ,
,
, .

: .

,
.


. ,
.


9
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

Limit To List - Yes,


Limit To List - No .

. , ,
; .
, .
, , .

,
,
,
. ,
(Limit To List - Yes).

27. (OLE Objects);

,
, , .
, . ,
, video
( ).

28. (Command Buttons);


Visual Basic for Applications (VBA) Access.
,
, .
,
.

,
..

29. (SubForm);

. ,

,
,
.

, , ,

.

(Reports)

30. Access ;


10
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

(reports) Access
(table) (query) Access.
()
, ,
(sum) .

,
(Report Wizards). , ,
, .

31. (Grouping);

Access

. /,

.


,
(group header) / (group footer).

,
Access , .
,
.

32. .
;


. , .
,
(, , ..)
.
, , , ,
( ..).

,
.

, , , .
, , .

, . ,

. ,
.
, , .

, ,
1 ,
, 2
.


11
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

(Macros)

33. Access ;

(macros) Access
. , ,
(conditions), ,
.

Access ,
. .,
, Access.

Close ( , ),
OpenForm ( ),
OpenReport ( ),
RunCode ( VBA),
RunMacro ( ),
StopMacro ( ),
GoToRecord ( ),
GoToControl ( ),
Maximize ( ),
Beep ( ),
Msgbox ( ).



. ,
:

[].[]

() ,
:

Forms![]![]


:
, ,

Event () OnClick
.


. , ,
.. , , , ..,
' .

(Modules)

34. Access ;


12
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

(modules) Access
Access. Access ,
.


Access . ,
, , , , (),
(functions) (subroutines).

Visual Basic for Applications (VBA), Access,


. ()
VBA (modules). :
.

35. ;


, .
, .


Modules ().

36. ;

.

Code (E)
Code View.

37.

.
Access Declarations (),
.

(Object)

, General.
,
(Proc)
.

(Proc)

,
. ,
.

38. ;


13
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

, Function () Sub ()
(Insert Procedure)
Procedure Insert. Access
End Function End Sub .

39. VBA

VBA
.

: Byte, Integer (%), Long (&), Single (!), Double (#), Currency (@), String
($), Boolean, Date Object, Variant User-defined.
.

40.

( ),
(
).

, Public
Declarations . ,
Public Const Declarations.


, Declarations .


, .

,
.
, , ,
. .., module1.intx module2.intx
(intx) .

, , , .

.

VBA

41.

Const

..

Public Const PI = 3.14159

Dim


14
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

Declarations
. , ,
Dim
.

..

Dim intMyInteger As Integer

Dim dbMyDatabase As Database

Dim strMyString (51 To 100) As String * 20

Public

Declarations .

..

Public lngMyNumber As Long

Private,
. Private default.

ReDim

..

ReDim strProductNames(20) As String * 25

Static


Access
.

..

Static intMyInteger As Integer

Static strMyString (51 To 100) As String * 20

Type


15
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

Declarations
.
Type .

,
Dim, Public Static
.

,
, .

..

Type MyRecord

lngID As Long

strLast As String

strFirst As String

strMid As String

End Type

...

Dim usrContacts As MyRecord

usrContacts.strLast = Jones

42. Access

Dim, ReDim Static.


60 . ,
0.
Option Base Declarations :

Option Base 1

-32.768
32.767.

43. Set


, .
:

Dim dbMyDB As Database


16
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

Set dbMyDB = CurrentDb()

dbMyDB .

Dim tblMyTable As TableDef

Set tblMyTable = dbMyDB.TableDefs![tblClubs]

tblMyTable tblClubs .

Dim fldMyField As Field

Set fldMyField = tblMyTable![Notes]

fldMyField Notes tblClubs


.

44.

Access
.
.

Dim dbEntSched As Database

Dim rcdClubs As RecordSet

Set dbEntSched = CurrentDb()

Set rcdClubs = dbEntSched.OpenRecordSet(tblClubs, dbOpenTable)

Move
. .. recordset.MoveFirst .
MoveLast, MoveNext MovePrevious.

, Find
. ,
AmountOwed 100$, :

Dim dbEntSched As Database

Dim rcdAPContracts As RecordSet

Set dbEntSched = CurrentDb()

rcdAPContracts.FindFirst AmountOwed > 100

,
Delete. ,
AmountOwed 0, :

rcdAPContracts.FindFirst AmountOwed = 0


17
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

If Not rcdAPContracts.NoMatch Then

rcdAPContracts.Delete

End If

,
Edit. ,
Update . , 10%
AmountOwed 100, :

rcdAPContracts.FindFirst AmountOwed > 100

If Not rcdAPContracts.NoMatch Then

rcdAPContracts.Edit

rcdAPContracts![AmountOwed] = rcdAPContracts![AmountOwed] * 1.1

rcdAPContracts.Update

End If

,
AddNew.
Update .

rcdClubs.AddNew

rcdClubs![ClubName] = Winthrop Brewing Co.

rcdClubs![StreetAddress] = 155 Riverside ave.

rcdClubs![City] = Winthrop

rcdClubs![State] = WA

rcdClubs![ZipCode] = 98862

rcdClubs![PhoneNumber] = (509) 996-3183

rcdClubs.Update

45.

VBA , , :
(Functions) (Subroutines).
. ,
.

Function


18
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

Function ,
,
.


. ByVal
, . ,
ByVal , .

ByRef ,
. , ByRef
, .

Exit Function
, .

, MyFunction
, :

Function MyFunction (intArg1 As Integer, strArg2 As String) As Double

< >

End Function

Sub

Sub ,
.

Exit Sub ,
.

, MySub
, , :

Sub MySub (ByVal strArg1 As String, ByRef strArg2 As String)

< >

End Sub

46.

Call

..

Call MySub (intMyInteger, curPrice * intQty)


19
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

Do ... Loop

.
While Until,
.

..

Do Until rcdClubs.EOF

< >

rcdClubs.MoveNext

Loop

For ... Next

..

For intI = 0 To 4

Debug.Print dbEntSched.QueryDefs(intI).Name

Next intI

For Each ... Next

..

For Each qdf In dbEntSched.QueryDefs

Debug.Print qdf.Name

Next qdf

GoTo

, , .

..


20
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

GoTo SkipOver

If ... Then ... Else

..

Dim strMyString As String, strFirst As String, intVal As Integer

strFirst = Ucase$(Mid$(strMyString, 1, 1))

If strFirst >= A And strFirst <= F Then

intVal = 1

ElseIf strFirst >= G And strFirst <= N Then

intVal = 2

ElseIf strFirst >= O And strFirst <= Z Then

intVal = 3

Else

intVal = 0

End If

Select Case

,
.

..

Dim strMyString As String, intVal As Integer

Select Case Ucase$(Mid$(strMyString, 1, 1))

Case A To F

intVal = 1

Case G To N

intVal = 2


21
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

Case O To Z

intVal = 3

Case Else

intVal = 0

End Select

Stop

While ... Wend

..

While Not rcdClubs.EOF

< >

rcdClubs.MoveNext

Wend

With

With Pascal.

..

Dim rst As Recordset, db As Database

Set db = CurentDb()

Set rst = db.OpenRecordset(MyTable, dbOpenDynaset, dbAppendOnly)

With rst

.Addnew

![FieldOne] = 1

![FieldTwo] = John


22
PDF created with pdfFactory trial version www.pdffactory.com
MS Access

![FieldThree] = Viescas

.Update

.Close

End With

47.

VBA . ,
, VBA,
VBA.
VBA, DoCmd.

DoCmd

.. Customer ,
:

DoCmd.OpenForm Customer, acNormal, , ,acAdd

Supplier, :

DoCmd.Close acForm, Supplier


23
PDF created with pdfFactory trial version www.pdffactory.com

You might also like