adv. access

28
web_consult13@ hotmail.com Adv. Access

Upload: kaylee

Post on 26-Jan-2016

33 views

Category:

Documents


3 download

DESCRIPTION

Adv. Access. Label. เป็นคอนโทรลสำหรับพิมพ์หรือแสดงข้อความ. Name Alignment AutoSize BorderStyle. Caption Left Top. Label (properties). TextBox. เป็นคอนโทรลที่ใช้รับข้อมูลที่เป็นตัวอักษรจาก Keyboard ของผู้ใช้. Text Box (properties). TabIndex เริ่มที่ 0 TabStop Text ToolTipText. - PowerPoint PPT Presentation

TRANSCRIPT

Page 2: Adv. Access

[email protected][email protected]

Labelเป็�นคอนโทรล

สำ� หร�บพิ�มพิ�หร�อแสำดงข้�อคว ม

Page 3: Adv. Access

[email protected][email protected]

Label (properties)

•Name•Alignment

•AutoSize

•BorderStyle

•Caption•Left•Top

Page 4: Adv. Access

[email protected][email protected]

TextBoxเป็�นคอนโทรลท��ใช้�ร�บ

ข้�อม!ลท��เป็�นตั�วอ�กษรจ กKeyboard ข้องผู้!�ใช้�

Page 5: Adv. Access

[email protected][email protected]

Text Box (properties)•Name

•MaxLenght

•Multiline

•PasswordChar

•ScrollBars

•TabIndex เร��มท�� 0

•TabStop•Text•ToolTipText

Page 6: Adv. Access

[email protected][email protected]

Command Button

เป็�นคอนโทรลท��ท� หน� ท��เป็�นป็'(มสำ� หร�บร�บค� สำ��งจ กผู้!�ใช้�

Page 7: Adv. Access

[email protected][email protected]

Command Button

(properties)•Name•Caption

•Default•Picture•Style

Page 8: Adv. Access

[email protected][email protected]

ตั�วอย่* งง นห ผู้ลค!ณระหว* ง 2 Text Box

Sub Command1_Click() a = Text1 b = Text2 Label3.Caption = a & " * " & b & " = " & a * bEnd Sub

Page 9: Adv. Access

[email protected][email protected]

ตั�วอย่* งง นห ผู้ลค!ณระหว* ง 2 Text Box

Page 10: Adv. Access

[email protected][email protected]

Sub Command1_Click() a = Text1 b = Text2 Label3.Caption = a & " * " & b & " = " & a * bEnd Sub

Source Code

Page 11: Adv. Access

[email protected][email protected]

Operator ท งคณ�ตัศ สำตัร� น�พิจน� คว ม

หม ย่ + บวก - ลบ * ค!ณ / ห ร \ ห ร

จ� นวนเตั.ม Mod

ห รเอ แตั*เศษ ^ ย่ก

ก� ล�ง

Page 12: Adv. Access

[email protected][email protected]

ตั�วอย่* งง นก รท� ง นก�บ Operator ท งคณ�ตัศ สำตัร� Sub Command1_Click()Dim a As IntegerDim b As Integera = Text1.Textb = Text2.TextLabel3.Caption = a & " / " & b & " = " & a / bLabel4.Caption = a & " \ " & b & " = " & a \ bLabel5.Caption = a & " mod " & b & " = " & a Mod bLabel6.Caption = a & " ^ " & b & " = " & a ^ bEnd Sub

Page 13: Adv. Access

[email protected][email protected]

ตั�วอย่* งง นก รท� ง นก�บ Operator ท งคณ�ตัศ สำตัร�

Page 14: Adv. Access

[email protected][email protected]

Sub Command1_Click()Dim a As IntegerDim b As Integera = Text1b = Text2Label3.Caption = a & " / " & b & " = " & a / bLabel4.Caption = a & " \ " & b & " = " & a \ bLabel5.Caption = a & " mod " & b & " = " & a Mod bLabel6.Caption = a & " ^ " & b & " = " & a ^ bEnd Sub

Page 15: Adv. Access

[email protected][email protected]

Operator ท งก รเป็ร�ย่บน�พิจน� คว มหม ย่

= เท* ก�บ > ม กกว* > = ม กกว* หร�อเท* ก�บ< น�อย่กว* < = น�อย่กว* หร�อเท* ก�บ< > ไม*เท* ก�บ

Page 16: Adv. Access

[email protected][email protected]

ตั�วอย่* งง นก รท� ง นก�บ Operator ท งก รเป็ร�ย่บเท�ย่บ

Sub Command1_Click()Dim a As StringDim b As Stringa = Text1b = Text2Label3.Caption = a & " > " & b & " = " & (a > b)Label4.Caption = a & " < " & b & " = " & (a < b)Label5.Caption = a & " = " & b & " = " & (a = b)Label6.Caption = a & " <> " & b & " = " & (a <> b)End Sub

Page 17: Adv. Access

[email protected][email protected]

ตั�วอย่* งง นก รท� ง นก�บ Operator ท งก รเป็ร�ย่บเท�ย่บ

Page 18: Adv. Access

[email protected][email protected]

Sub Command1_Click()Dim a As StringDim b As Stringa = Text1b = Text2Label3.Caption = a & " > " & b & " = " & (a > b)Label4.Caption = a & " < " & b & " = " & (a < b)Label5.Caption = a & " = " & b & " = " & (a = b)Label6.Caption = a & " <> " & b & " = " & (a <> b)End Sub

Page 19: Adv. Access

[email protected][email protected]

Operator ในก รเช้��อมตั*อข้�อม!ล

& และ + ใช้�ในก รเช้��อมข้�อม!ล

Page 20: Adv. Access

[email protected][email protected]

If…Then…Else

Statement If เง��อนไข้ Then Statement

….……….. End If

ร!ป็แบบท�� 1

Page 21: Adv. Access

[email protected][email protected]

If…Then…Else StatementIf เง��อนไข้ Then

Statement .1.Else

Statement .2.End If

Page 22: Adv. Access

[email protected][email protected]

If…Then…Else

Statement If เง��อนไข้ Then Statement…Elseif เง��อนไข้ Then

Statement…Elseif เง��อนไข้ Then

…Else

Statement สำ'ดท� ย่End if

Page 23: Adv. Access

[email protected][email protected]

ก รค� นวณแบบม�เง��อนไข้

กรณ� 2 เง��อนไข้ ค� นวณโบน�สำเง��อนไข้ ด�งน�0 ถ้� เง�นเด�อนน�อย่กว* 10000 บ ท ได�ร�บโบน�สำ 40% ข้องเง�นเด�อน ถ้� เง�นเด�อน10000 บ ทข้20นไป็ ได�ร�บโบน�สำ 50% ข้องเง�นเด�อน

ตั�วอย่* งง น

Page 24: Adv. Access

[email protected][email protected]

IF txtsalary< 10000 then txtbonus = txtsalary*0.40Else txtbonus= txtsary *0.50End if

ตั�วอย่* งง น

Page 25: Adv. Access

[email protected][email protected]

ก รค� นวณแบบม�เง��อนไข้กรณ�ม กกว* 2 เง��อนไข้ ค� นวณโบน�สำเง��อนไข้ ด�งน�0 ถ้� เง�นเด�อนน�อย่กว* 10000 บ ท ได�ร�บโบน�สำ 40% ข้องเง�นเด�อน ถ้� เง�นเด�อน 10000 - 30000 บ ท ได�ร�บโบน�สำ 50% ข้องเง�นเด�อน ถ้� เง�นเด�อนม กกว* 30000 บ ท ได�ร�บโบน�สำ 70% ข้องเง�นเด�อน

ตั�วอย่* งง น

Page 26: Adv. Access

[email protected][email protected]

If txtsalary< 10000 thenTxtbonus = txtsalary*.40Elseif txtsalary<=30000 thenTxtbonus = txtsalary*.50Else txtbonus = txtsalary*.70End if

ตั�วอย่* งง น

Page 27: Adv. Access

[email protected][email protected]

End CommandDocmd.Close

ป็3ดฟอร�มDocmd.Quit ออกจ กโป็รแกรม

Page 28: Adv. Access

[email protected][email protected]

•ใบง นท�� 3 (Blog สำ��อก รสำอน)

Work 3