Deck 11: Using and Writing Visual Basic for Applications Code
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Question
Match between columns
Unlock Deck
Sign up to unlock the cards in this deck!
Unlock Deck
Unlock Deck
1/75
Play
Full screen (f)
Deck 11: Using and Writing Visual Basic for Applications Code
1
The event name for a procedure being viewed in the VBE is indicated in the Object box. ____________________
False
2
A control is hidden in Access when the Visible property is False in a Case statement.
True
3
When using the RGB function in VBA, the color range for each value must be between the numbers of 0 through 150.
False
4
To convert a string to proper case where the first letter of every word in the string is uppercase, the StrConv function is used in VBA code.____________________
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
5
It is important to enter VBA code using appropriate capitalization in all statements so that the code can be read and maintained properly.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
6
Procedures included in a standard module may only be used by the form or report for which the event procedure was coded.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
7
VBA has features that are unique for each Microsoft Office program in addition to features that are common across applications.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
8
The AfterUpdate event occurs before data is changed in a control or record and the data is updated in the database.____________________
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
9
A control is displayed when the IsNull property is True in a procedure statement.____________________
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
10
The statement that indicates a Case control structure ends with End Select.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
11
Access events all have associated event properties.____________________
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
12
Event procedures are always Sub procedures.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
13
VBA procedures are created, modified, and displayed in the ____ window.
A)Immediate
B)Code
C)VBA
D)Query
A)Immediate
B)Code
C)VBA
D)Query
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
14
An input mask can accomplish the same verification procedures on data that VBA can accomplish such as verifying the @ symbol in an email address.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
15
The Declarations section of a VBA module contains statements that apply to all procedures in the module.____________________
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
16
When a module is created it must begin with a Procedures section that applies to all procedures in the module.____________________
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
17
The function that accepts a single string argument as input, converts the value of the argument to lowercase letters, then returns the converted value is the LCase function. ____________________
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
18
An example of a conditional control structure is the Case control structure.____________________
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
19
The way an object responds when an event occurs is determined by an associated object property.____________________
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
20
It is not possible to convert an Access macro to VBA code.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
21
VBA is considered to be a(n)____ programming language because instructions are executed on objects in the database.
A)markup
B)object-oriented
C)compiler
D)assembly
A)markup
B)object-oriented
C)compiler
D)assembly
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
22
To assign a purple ForeColor property to a control, the ____ function of VBA must be used.
A)vbColor
B)vbPurple
C)RGB
D)RGCYK
A)vbColor
B)vbPurple
C)RGB
D)RGCYK
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
23
The type of procedure that executes instructions and accepts input values, but does not return a value and cannot be used in expressions, is a(n)____ procedure.
A)Function
B)Sub
C)Reference
D)Comment
A)Function
B)Sub
C)Reference
D)Comment
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
24
Which of the following is a type of VBA procedure?
A)Format
B)Control
C)Reference
D)Function
A)Format
B)Control
C)Reference
D)Function
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
25
Which code statement will test a control to see if the data meets specific requirements?
A)VisitDate.ForeColor=vbRed
B)ZipCode=27531
C)Select Case [State]
D)If VisitDate
A)VisitDate.ForeColor=vbRed
B)ZipCode=27531
C)Select Case [State]
D)If VisitDate
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
26
When a procedure is created, the ____ determines where the procedure is available.
A)Declarations statement
B)scope
C)Procedure
D)object properties
A)Declarations statement
B)scope
C)Procedure
D)object properties
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
27
The type of procedure that may be used by more than one object in a database is a(n)____.
A)standard module
B)function statement
C)public procedure
D)declarations module
A)standard module
B)function statement
C)public procedure
D)declarations module
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
28
A predefined memory location initialized to a value that does not change in VBA is called a(n)____.
A)Procedure default
B)VBA constant
C)Function constant
D)Property default
A)Procedure default
B)VBA constant
C)Function constant
D)Property default
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
29
Which of the following Access events accepts new or changed data from a user entry by default.
A)OnClick
B)AfterUpdate
C)OnChange
D)OnKeyPress
A)OnClick
B)AfterUpdate
C)OnChange
D)OnKeyPress
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
30
Which of the following is a method used in a procedure to move the focus to a specific object or control.
A)Dim
B)SetFocus
C)Me.Undo
D)IsNull
A)Dim
B)SetFocus
C)Me.Undo
D)IsNull
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
31
In the Declarations statement "Option Compare Database," Database determines how the procedure will ____ the data.
A)organize
B)filter
C)run
D)sort
A)organize
B)filter
C)run
D)sort
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
32
In a Case control structure, Case Else instructs the procedure to ____.
A)stop running
B)sort data in a new manner
C)filter data based on new requirements
D)start an alternative set of actions
A)stop running
B)sort data in a new manner
C)filter data based on new requirements
D)start an alternative set of actions
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
33
To declare variables and the VBA data types associated with those variables in a procedure a(n)____ must be used.
A)Sub statement
B)Declaration statement
C)Dim statement
D)Case statement
A)Sub statement
B)Declaration statement
C)Dim statement
D)Case statement
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
34
The purpose of a VBA ____ is to respond to an event that occurs with an object or form control in an Access database.
A)statement
B)Case control
C)event
D)procedure
A)statement
B)Case control
C)event
D)procedure
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
35
The Immediate window allows the developer to test or ____ individual lines of VBA code.
A)restore
B)compile
C)debug
D)append
A)restore
B)compile
C)debug
D)append
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
36
Visual Basic for Applications is a(n)____ provided with Microsoft Office programs.
A)application
B)event builder
C)programming language
D)system program
A)application
B)event builder
C)programming language
D)system program
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
37
A ____ module is automatically created when the first event procedure for a form or report is created and it is associated with that specific form or report.
A)class
B)local
C)standard
D)public
A)class
B)local
C)standard
D)public
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
38
VBA code is created and modified using the ____.
A)Visual Basic Window
B)Visual Basic Editor
C)Visual Basic Design view
D)Procedure Window
A)Visual Basic Window
B)Visual Basic Editor
C)Visual Basic Design view
D)Procedure Window
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
39
VBA is considered to be what type of language?
A)rule-based programming language
B)a markup language
C)an assembly language
D)an event-driven language
A)rule-based programming language
B)a markup language
C)an assembly language
D)an event-driven language
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
40
Which of the following color options may be assigned to a control property as a VBA constant?
A)vbRed
B)RGB(255,0,0)
C)CMYK(0, 21, 151)
D)vbRGB(151, 12, 276)
A)vbRed
B)RGB(255,0,0)
C)CMYK(0, 21, 151)
D)vbRGB(151, 12, 276)
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
41
The following code is testing a field in the associated form for specific input. Which string is the Case structure looking for in the form?
Select Case [Course]
Case "CIS 101"
lblMessage, Caption = "Prerequisite CIS 100 required"
A)Course
B)CIS 100
C)CIS 101
D)Prerequisite CIS 100 required
Select Case [Course]
Case "CIS 101"
lblMessage, Caption = "Prerequisite CIS 100 required"
A)Course
B)CIS 100
C)CIS 101
D)Prerequisite CIS 100 required
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
42
Which VB constant used in conjunction with the StrConv function will convert all characters of a string to upper case letters?
A)vbProperCase
B)vbLowerCase
C)vbUpperCase
D)vbAllCaps
A)vbProperCase
B)vbLowerCase
C)vbUpperCase
D)vbAllCaps
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
43
Because Louisa's code will only be used in Access, she can use a VBA constant in the code argument to change the City field's value to proper case. Which VBA constant should Louisa use?
A)vbUpperCase
B)vbLowerCase
C)vbChangeCase
D)vbProperCase
A)vbUpperCase
B)vbLowerCase
C)vbChangeCase
D)vbProperCase
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
44
List four advantages of using VBA rather than macros in Access.
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
45
Which code best represents the procedure Louisa has written to convert the City field values to proper case in the database?
A)Private Sub EventProcedure _ VB Constant 'Convert City to proper case [ Field ] = VBA Function ([ Field ], Event Procedure
End Sub
B)Private Sub Field _ EventProcedure 'Convert City to proper case [ Field ] = VBA Function ([ Field ], VB Constant
End Sub
C)Private Sub Field _ EventProcedure 'Convert City to proper case [ VB Constant ] = VBA Function ([ Field ], Field
End Sub
D)Private Sub VB Function _ EventProcedure 'Convert City to proper case [ VBAFunction ] = ([ Field ], VB Constant
End Sub
A)Private Sub EventProcedure _ VB Constant 'Convert City to proper case [ Field ] = VBA Function ([ Field ], Event Procedure
End Sub
B)Private Sub Field _ EventProcedure 'Convert City to proper case [ Field ] = VBA Function ([ Field ], VB Constant
End Sub
C)Private Sub Field _ EventProcedure 'Convert City to proper case [ VB Constant ] = VBA Function ([ Field ], Field
End Sub
D)Private Sub VB Function _ EventProcedure 'Convert City to proper case [ VBAFunction ] = ([ Field ], VB Constant
End Sub
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
46
A control is not displayed when the Visible property is to ____.
A)Yes
B)No
C)True
D)False
A)Yes
B)No
C)True
D)False
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
47
Color values for controls may be coded in several different ways. Which type of color value represents color intensities of red, green, and blue instead of the color values ranging from 0-255?
A)RGB
B)VB constant
C)ColorIndex
D)hexadecimal
A)RGB
B)VB constant
C)ColorIndex
D)hexadecimal
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
48
Case-Based Critical Thinking Questions
Case 11-2 The Environmental Policy Group is collecting data on weather conditions throughout the southeast U.S. The database used for data collection is being used by field technicians throughout the region. Louisa has been asked to update the database to reduce data entry mistakes. Louisa will create some new procedures and update others in the database.
Louisa wants to be sure that all city locations are recorded in proper case in the database. To do this, she needs to use the ____ event procedure which will automatically change the data entered in the City field to proper case any time a value is entered or changed in the field. For instance, if the user enters san antonio in the City field, the procedure will change the data to San Antonio and store it in the database.
A)OnChange
B)OnEnter
C)AfterUpdate
D)BeforeUpdate
Case 11-2 The Environmental Policy Group is collecting data on weather conditions throughout the southeast U.S. The database used for data collection is being used by field technicians throughout the region. Louisa has been asked to update the database to reduce data entry mistakes. Louisa will create some new procedures and update others in the database.
Louisa wants to be sure that all city locations are recorded in proper case in the database. To do this, she needs to use the ____ event procedure which will automatically change the data entered in the City field to proper case any time a value is entered or changed in the field. For instance, if the user enters san antonio in the City field, the procedure will change the data to San Antonio and store it in the database.
A)OnChange
B)OnEnter
C)AfterUpdate
D)BeforeUpdate
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
49
Case-Based Critical Thinking Questions
Case 11-1
Luca is the database administrator for a city parks and recreation department. The department routinely uses community college interns to process applications and registration for the department's programs. It is important that the user interface minimize user input errors as much as possible.
Luca wants to be sure that a message appears to the user prompting that an email be sent to all program participants reminding them of the date the program begins when the Paid field in the form is marked paid. What type of structure will Luca use to code an expression that tests the Paid field for an entry?
A)If structure
B)Case control structure
C)Compare control structure
D)If, then structure
Case 11-1
Luca is the database administrator for a city parks and recreation department. The department routinely uses community college interns to process applications and registration for the department's programs. It is important that the user interface minimize user input errors as much as possible.
Luca wants to be sure that a message appears to the user prompting that an email be sent to all program participants reminding them of the date the program begins when the Paid field in the form is marked paid. What type of structure will Luca use to code an expression that tests the Paid field for an entry?
A)If structure
B)Case control structure
C)Compare control structure
D)If, then structure
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
50
In addition to the single quotation mark ('), a comment line in VBA code may begin with ____.
A)Rem
B)Comment
C)slash (/)
D)semi-colon (;)
A)Rem
B)Comment
C)slash (/)
D)semi-colon (;)
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
51
Which VB data type stores values of True or False?
A)Decimal
B)Object
C)Variant
D)Boolean
A)Decimal
B)Object
C)Variant
D)Boolean
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
52
Case-Based Critical Thinking Questions
Case 11-1
Luca is the database administrator for a city parks and recreation department. The department routinely uses community college interns to process applications and registration for the department's programs. It is important that the user interface minimize user input errors as much as possible.
Because the event procedure that Luca is coding will only be used for the Participant Information form, the procedure is a(n)____ procedure.
A)private
B)public
C)remote
D)shared
Case 11-1
Luca is the database administrator for a city parks and recreation department. The department routinely uses community college interns to process applications and registration for the department's programs. It is important that the user interface minimize user input errors as much as possible.
Because the event procedure that Luca is coding will only be used for the Participant Information form, the procedure is a(n)____ procedure.
A)private
B)public
C)remote
D)shared
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
53
A comment line in the Code windows is indented and appears in the color ___.
A)red
B)green
C)blue
D)black
A)red
B)green
C)blue
D)black
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
54
List the five VBA naming rules that must be followed when naming VBA elements such as Sub procedures, arguments, and functions
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
55
In the following code, which field in the associated form is being used for the Case structure?
Select Case [Course]
Case "CIS 101"
lblMessage, Caption = "Prerequisite CIS 100 required"
A)CIS 101
B)Course
C)CIS 100
D)Case CIS 101
Select Case [Course]
Case "CIS 101"
lblMessage, Caption = "Prerequisite CIS 100 required"
A)CIS 101
B)Course
C)CIS 100
D)Case CIS 101
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
56
Case-Based Critical Thinking Questions
Case 11-1
Luca is the database administrator for a city parks and recreation department. The department routinely uses community college interns to process applications and registration for the department's programs. It is important that the user interface minimize user input errors as much as possible.
Luca needs to use a VBA function in his code to return a value of True if the Paid field has no data or a value of False if the Paid field is not empty. Which VBA function should Luca use?
A)IsPaid
B)IsNum
C)IsNull
D)IsBound
Case 11-1
Luca is the database administrator for a city parks and recreation department. The department routinely uses community college interns to process applications and registration for the department's programs. It is important that the user interface minimize user input errors as much as possible.
Luca needs to use a VBA function in his code to return a value of True if the Paid field has no data or a value of False if the Paid field is not empty. Which VBA function should Luca use?
A)IsPaid
B)IsNum
C)IsNull
D)IsBound
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
57
The Visual Basic window is accessed using the ____ group from the Create tab.
A)Forms
B)Macros & Code
C)Templates
D)VBA
A)Forms
B)Macros & Code
C)Templates
D)VBA
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
58
All event procedures in a class module are a(n)____ procedures which means they may only be used for the form or report for which the class module was created.
A)public
B)local
C)Case
D)Sub
A)public
B)local
C)Case
D)Sub
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
59
Case-Based Critical Thinking Questions
Case 11-1
Luca is the database administrator for a city parks and recreation department. The department routinely uses community college interns to process applications and registration for the department's programs. It is important that the user interface minimize user input errors as much as possible.
After creating the message control using VBA, which property of the control must be coded to display the message "Email the participant with the start date of the program"?
A)Caption
B)Text
C)Special Effect
D)Statement
Case 11-1
Luca is the database administrator for a city parks and recreation department. The department routinely uses community college interns to process applications and registration for the department's programs. It is important that the user interface minimize user input errors as much as possible.
After creating the message control using VBA, which property of the control must be coded to display the message "Email the participant with the start date of the program"?
A)Caption
B)Text
C)Special Effect
D)Statement
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
60
If the Paid field is marked as paid in the Participant Information form, Luca wants the following message to appear on the screen "Email the participant with the start date of the program." Which type of VBA control should Luca use in the procedure to create the message?
A)combo box
B)radio button
C)message
D)label
A)combo box
B)radio button
C)message
D)label
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
61
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
62
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
63
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
64
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
65
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
66
Why is it recommended that procedures be compiled after they are first created or when changes are made to the procedure code?
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
67
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
68
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
69
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
70
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
71
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
72
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
73
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
74
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck
75
Match between columns
Unlock Deck
Unlock for access to all 75 flashcards in this deck.
Unlock Deck
k this deck