• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 9. Advanced VBA Techniques > What Are User-Defined Types and Why Would ...

What Are User-Defined Types and Why Would You Use Them?

A user-defined type, known as a struct or record, allows you to create a variable containing several pieces of information. User-defined types are often used to hold information from one or more records in memory. Because each element of a user-defined type can be instructed to hold a particular type of data, each element in the type can be defined to correspond to the type of data stored in a specific field of a table. A user-defined type might look like this:

Public Type TimeCardInfo
   TimeCardDetailID As Long
   TimeCardID As Long
   DateWorked As Date
   ProjectID As Long
   WorkDescription As String * 255
   BillableHours As Double
   BillingRate As Currency
   WorkCodeID As Long
End Type


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint