.


:




:

































 

 

 

 





, , VB. , Variant , , , . . VB- . , .


As. TextContent :

Dim TextContent As String

, :

Dim NumberContent As Long

. Visual Basic. String, Date, Boolean ( ), Long (, ), single ( ) Currency ( , ).

VB Access. : Microsoft Visual Basic (Microsoft Visual Basic Help → Microsoft Visual Basic help) Visual Basic. Visual Basic for Applications Language ReferenceVisual Basic Language ReferenceData Types.

, . , .

:

TextContent = " "

. .

Dim TextContent

'

TextContent = TextBoxOne.Value

 

'

TextBoxOne.Value = TextBoxTwo.Value

 

'

TextBoxTwo.Value = TextContent

 

, , , . . , . . .


: , ( ). . , = (), < ( ), > ( ) ( ). , Price=10 . ( Price 10) ( ). . Visual Basic .

. . , , If. If , . , Access .

If, , Price 100. , Access :

If Price > 100 Then

MsgBox ", ."

End If

, If If End If. If , . , , .

. , , . , (Country) .

' ,

Dim TaxRate

If Country = "U.S.A." Then

' (7%)

TaxRate =1.07

Elself Country = "Canada" Then

' (14%)

TaxRate =1.14 Else

'

TaxRate =1 End If


'

TotalWithTax.Caption = Price * TaxRate

 
 

I f . Access - , , . , End I f, , . , Access Else ( ). . 17.2 .

 

. 17.2. , , . (On Current), ,

 

. And Or , . .

15 , . : WantsEmail Email Address. WantsEmail (Yes), EmailAddress


. WantsEmail (No), EmailAddress . VB- , If ( 1):

1 Private Sub Form_BeforeUpdate(Cancel As Integer)

' ,

2 If WantsEmail = True Then

' , EmailAddress

3 If EmailAddress = "" Or IsNull(EmailAddress) Then

' .

'

4 MsgBox "You can't be notified without an email address."

5 Cancel = True

6 End If

7 End If

8 End Sub

.

1 , (On Before Update). , True () False () Cancel, .

2 If, WantsEmail.

3 . , , . , ( ) (. . ; . null . " " 4).

4 . , , If True. False ( WantsEmail EmailAddress ), Access .

 

 

If , . ( , ) . , , .

1 . , . .


5 Cancel, (On Before Update). , .

68 : If .

Access , , (On Before Update). Cancel, . , True , .

 

 





:


: 2016-03-28; !; : 413 |


:

:

, .
==> ...

1554 - | 1435 -


© 2015-2024 lektsii.org - -

: 0.012 .