Airfield Models - Visual Basic Database

Converting VB DB to a Daily Quote Applet (Developer's Version) - Step 4

May 05, 2015



Home
About
Site Feedback
Register
Contact
Site Map
Add to Favorites
Tell a Friend
Comments
Items For Sale
Search Airfield Models

Back to VB DB

 

Airfield Models (http://www.airfieldmodels.com/)Converting VB DB to a Daily Quote Applet
(Developer's Version)

Download VB DB Source Code here.

 
 

Step 4 of 7

In the CreateDataFields Sub in the cTable Class.cls class module, create the default Field definitions for the fields in your tables.

Before conversion

' cTable.cls Class

Private Sub CreateDataFields()

' ***** MODIFY *****

' Before creating fields, modify the FIELD_INDEX Enum in bVBDB.bas
' Then use the values from the Enum as subscripts for your fields

' Note: You can assign the Constant CurrentDateTime (-1) to a date
' field if you want the value Now() to be used as the default.

With m_FieldDefinitions(FIELD_01)
  .ArrayField = False
  .DataType = dataBoolean
  .DefaultValue = False
  .FieldName = "Boolean 1"
  .Index = NewFieldIndex
  .Required = False
  .RequireUniqueEntry = False
  .SystemField = False
End With

' Code for remaining fields not shown for brevity

' ***** END MODIFY *****

End Sub

After conversion

For this example we delete all the Field_XX fields and create the definitions for the two fields in the FIELD_INDEX Enum:

QUOTE_TEXT
QUOTE_AUTHOR

' cTable.cls Class module

Private Sub CreateDataFields()

' Add code to define the two fields we created in
' the FIELD_INDEX Enum.

' Create QUOTE_TEXT Field
With m_FieldDefinitions(QUOTE_TEXT)
  .ArrayField = False
  .DataType = dataString ' Data type for the field
 
.DefaultValue = vbNullString
  .FieldName = "Quote" ' Field display name
 
.Index = NewFieldIndex
  .Required = True
  .RequireUniqueEntry = False
  .SystemField = False
End With

' Create QUOTE_AUTHOR Field
With m_FieldDefinitions(QUOTE_AUTHOR)
  .ArrayField = False
  .DataType = dataString
  .DefaultValue = "Anonymous"
  .FieldName = "Author"
  .Index = NewFieldIndex
  .Required = True
  .RequireUniqueEntry = False
  .SystemField = False
End With

End Sub

 
 

Previous
Next

Step 3 of Converting VB DB to a Daily Quote Applet (Developer's Version)
Step 5 of Converting VB DB to a Daily Quote Applet (Developer's Version)

Comments about VBDB

 
 

Back to VB DB
Airfield Models Home

 
 

Copyright 2002-2005 Paul K. Johnson