data types Flashcards

1
Q

data types

A

not just numbers used in computations
- also texts (alphanumeric) such as names, dates, etc and logical data (true/false) also used
- data stored in different forms

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

numbers

A

integer numbers (Integer and Long)
* whole numbers used for counting (answers question “How many?”)
* two types
- Integer
▪ stored in memory locations consisting of 2 bytes (16 bits) each
▪ so are limited to the range -32,768 to 32,767
- Long
▪ stored in 4 bytes (32 bits)
▪ range from -2,147,483,648 to 2,147,483,647
** real (or decimal) numbers (Single and Double)**
* used for measuring (answers question “How much?”)
* * two types
- Single
▪ single precision numbers are stored in memory locations consisting of 4
bytes (32 bits) each
▪ approx. 7 sig figs
▪ ranges
* negative numbers: approx. -3.4E38 to -1.4E-45
* positive numbers: approx. 1.4E-45 to 3.4E38
- Double
▪ double precision numbers stored in 8 bytes
▪ approx. 15 sig figs
▪ ranges
* negative numbers: approx. -1.8E308 to -4.9E-324
* positive numbers: approx. 4.9E-324 to 1.8E308

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

characters (String)

A

sequences of characters that can be letters, numbers, punctuation marks, and spaces
▪ types
* fixed-length
- number of characters (or upper limit) is known
- can contain 1 to 65,000 characters
* variable-length
- number of characters unknown
- can contain up to 2 billion characters

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Logical (Boolean) values

A

can take on two values
* true=1
* false = 0
▪ type of data used in If statements

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

type declarations

A

unlike most other programs, VBA lets you introduce new constants and variables without specifying type
-when undeclared variable encountered, VBA calls it Variant type
▪ will read assigned data and choose type for it depending on context
▪ if variable is later used to store different type of data, the variable type is automatically changed by
VBA
- downsides
▪ Variant type data can use more memory than declared variables
▪ when Variant type data encountered, VBA must stop and decide what kind of data storage location
is required, which slows it down (but you most likely won’t notice the performance hit)
▪ a misspelled variable name could be difficult to spot
-lack of readability – can’t easily determine appropriate data type by viewing code, so that can be problem
▪ only use when you’re uncertain of data’s type or when accommodating foreign data and you’re unsure of data type’s specifications
▪ input: Dim variable
- it’s a good idea to get into habit of declaring your variable types

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

the Dim statement

A

to declare certain data type for a variable
Dim variable1 name As type 1, variable 2 name As type 2, …

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

the Option Explicit statement

A

force the issue by placing the statement “Option Explicit” as first line in module
- if you do this, ALL variables in module MUST be declared

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

byte data type

A

VBA’s smallest numeric data type
▪ holds numeric value from 0 to 255
▪ doesn’t include negative values

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

currency data type

A

uses currency numeric data to store monetary values from -9 trillion to +9 trillion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

date data type

A

stores specially formatted numeric value that represents both the date and time
▪ don’t have to store both date and time value
▪ date data type accepts either date or time or both
▪ ranges from January 1, 100 to December 31, 9999

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

decimal data type

A

subtype of Variant

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

object data type

A

actually a reference to an Access object such as form, report, or control

How well did you know this?
1
Not at all
2
3
4
5
Perfectly