VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Create database, tables, states, countries, format phone, format social security number

by Agbon M. Aitanun (2 Submissions)
Category: Databases/Data Access/DAO/ADO
Compatability: Visual Basic 5.0
Difficulty: Unknown Difficulty
Originally Published: Tue 16th August 2005
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Create database, tables, states, countries, format phone, format social security number

API Declarations


Public WhereIsTheDatabase
Public New_App_Path
Public AppDataBaseFile
Public ass1, ass2
Public ThisOldValue
Public xxLastname As String
Public xxFirstname As String
Public AccessFileName As String
Public Daylimit As Integer
Public Rs_User_file
Public Rs_System_file
Public UserDatabasePath As String
Public Help_Line As Boolean


Rate Create database, tables, states, countries, format phone, format social security number




Public Function FormatTelephone(ByVal TextValue As Integer, LabelText, Textname As Control)
  Dim holdvalue
  holdvalue = ""
    If Trim(LabelText) = "Main Phone #" Or Trim(LabelText) = "Alternate Phone #" Then
      If TextValue <> 8 Then
          If TextValue <> 0 Then
             
             ' Store user typed value...
             ' =========================
             holdvalue = Chr$(TextValue)
             Textname.Refresh
             Textname = Textname & holdvalue
             TextValue = 0   ' Clear the value typed in...
             
             If Len(Textname.Text) <> 3 Then
                Textname.SelStart = Textname.SelStart + Len(Textname.Text) + 1
             End If
             
             ' US Telephone number is 10 digits long, excluding dashes...
             ' ==========================================================
             If Len(Textname.Text) = 12 Then  ' With the dashes...
                SendKeys "{TAB}"
             End If
             
             If Len(Textname.Text) = 3 Then
                 ' Add dash symbol to the end of the text.
                 ' if len of text entered is equal 3
                 ' =======================================
                 Textname.Text = Textname.Text & "-"
                 Textname.SelStart = Textname.SelStart + Len(Textname.Text) + 1
             End If
            
             If Len(Textname.Text) = 7 Then
                 ' Add dash symbol to the end of the text.
                 ' if len of text entered is equal 7
                 ' =======================================
                 Textname.Text = Textname.Text & "-"
                 Textname.SelStart = Textname.SelStart + Len(Textname.Text) + 1
             End If
          End If
      End If
      
      If TextValue = 8 Then
           TextValue = 0
           If Textname.Text <> "" Then
               ' Blank the last key, that is, the backspace key.
               ' ===============================================
               Textname.Text = Left(Trim(Textname.Text), Len(Textname.Text) - 1)
              
               ' Set cursor position to the end of the text.
               ' ===========================================
               Textname.SelStart = Len(Textname.Text)
           End If
      End If
    End If
    FormatTelephone = Trim(Textname.Text)
End Function

' ===============================================
' Function to create or open database and tables.
' ===============================================
Sub Main()
    ' ===========================================
    ' To track help file launch
    Help_Line = False
    
    ' Create or open database/table...
    ' ________________________________
    Call Open_Or_Create_Databases
    
End Sub

Public Sub Open_Or_Create_Databases()
  Dim xTblDefaultName As TableDef
  Dim xFldName
  Dim xFldindex As Index
  Dim IdxNewUser
  Dim IdxNew
  Dim strNWpath
  Dim SPLIT_A
  Dim SPLIT_B
  SPLIT_A = ""
  SPLIT_B = ""
  
  UserDatabasePath = App.Path & "\Taxes_2\Tax_DataBase"
  
  If Len(Dir(UserDatabasePath, vbDirectory)) <> 0 Then
          ' Open sequential text file for read and write in shared mode
          ' if it was created already...
          ' ====================================
          Dim PrevDir As String, PrevDir1 As String
          If Right(RTrim(App.Path), 1) <> "\" Then
             AccessFileName = App.Path & "\Taxes_2\Tax_DataBase"
          Else
             AccessFileName = App.Path & "Taxes_2\Tax_DataBase"
          End If
          
          Open Trim(AccessFileName) & "\PreviousPath" For Input Shared As #1
          If Not EOF(1) Then
              Line Input #1, PrevDir
              PrevDir1 = PrevDir
              AccessFileName = PrevDir1
          End If
          Close #1
  Else
         If Right(App.Path, 1) = "\" Then
            AccessFileName = App.Path & "Taxes_2\Tax_DataBase"
         Else
            AccessFileName = App.Path & "\Taxes_2\Tax_DataBase"
         End If
        
         AccessFileName = Trim(AccessFileName)
         
         If Trim(AccessFileName) <> 0 Then
            If Left(Trim(AccessFileName), 1) = "\" Then
              AccessFileName = Mid(Trim(AccessFileName), 2, Len(AccessFileName))
            End If
         End If
          
          ' Prompt user to create database location...
          ' ============================================
          AccessFileName = App.Path & "\Taxes_2"
   
          If Len(Dir(AccessFileName, vbDirectory)) = 0 Then
             MkDir AccessFileName
             AccessFileName = AccessFileName & "\Tax_DataBase"
             If Len(Dir(AccessFileName, vbDirectory)) = 0 Then
                MkDir AccessFileName
                AccessFileName = Trim(AccessFileName)
             Else
                AccessFileName = Trim(AccessFileName)
             End If
          Else
             AccessFileName = AccessFileName & "\Tax_DataBase"
             If Len(Dir(AccessFileName, vbDirectory)) = 0 Then
                MkDir AccessFileName
                AccessFileName = Trim(AccessFileName)
             End If
          End If
          
          ' Remove back slash from the AccessFileName if any...
          ' =====================================================
          If Right(Trim(AccessFileName), 1) = "\" Then
             AccessFileName = Left(Trim(AccessFileName), Len(Trim(AccessFileName) - 1))
          End If
          
          Open AccessFileName & "\PreviousPath" For Output Shared As #1
          Print #1, LTrim(AccessFileName)
          Close #1
  End If
 
  If Len(Dir(AccessFileName, vbDirectory)) = 0 Then
         
         ' ==================================================================
         ' First time use, specify database directory.
         ' ==================================================================
         AccessFileName = Trim(AccessFileName)
         
         If Trim(AccessFileName) <> 0 Then
            If Left(Trim(AccessFileName), 1) = "\" Then
              AccessFileName = Mid(Trim(AccessFileName), 2, Len(AccessFileName))
            End If
            If InStr(1, AccessFileName, "\", vbTextCompare) > 0 Then
                 SPLIT_A = Left(AccessFileName, InStr(1, AccessFileName, "\", 0) - 1)
                 SPLIT_B = Mid(Trim(AccessFileName), Len(SPLIT_A) + 2, Len(Trim(AccessFileName)))
                   
                 If Right(App.Path, 1) <> "\" Then
                    SPLIT_A = "\" & SPLIT_A
                    If Dir(App.Path & SPLIT_A, vbDirectory) = "" Then
                      MkDir (App.Path & SPLIT_A)
                    End If
                 Else
                    MkDir (App.Path & SPLIT_A)                      ' MKDIR Is VB Built in Function
                 End If
                    
                 If Right(App.Path & SPLIT_A, 1) <> "\" Then
                    AccessFileName = SPLIT_A & "\" & SPLIT_B
                    If Dir(App.Path & AccessFileName, vbDirectory) = "" Then
                         MkDir (App.Path & AccessFileName)                      ' MKDIR Is VB Built in Function
                    End If
                 End If
              
            ' If user entered 1 sub directory...
            ' =======================================
            ElseIf InStr(1, AccessFileName, "\", vbTextCompare) = 0 Then
                 If Trim(AccessFileName) <> "" Then
                      If Right(App.Path, 1) <> "\" Then
                           AccessFileName = "\" & AccessFileName
                           If Len(Dir(App.Path & AccessFileName, vbDirectory)) = 0 Then
                                MkDir (App.Path & AccessFileName)                      ' MKDIR Is VB Built in Function
                           End If
                      Else
                           If Len(Dir(App.Path & AccessFileName, vbDirectory)) = 0 Then
                                MkDir (App.Path & AccessFileName)                      ' MKDIR Is VB Built in Function
                           End If
                      End If
                 End If
            End If
         End If
         
         If Left(Trim(AccessFileName), 1) = "\" Then
            New_App_Path = (App.Path & AccessFileName)
         Else
            New_App_Path = (App.Path & "\" & AccessFileName)
         End If
         
         Open New_App_Path & "\Users" For Output Shared As #1
         Close #1
       
         Open New_App_Path & "\System_File" For Output Shared As #1
         Close #1
         
  End If

    New_App_Path = Trim(AccessFileName)
    WhereIsTheDatabase = (AccessFileName & "\Taxes.mdb")

    ' Store the directory the user Created above for future use...
    ' ====================================
    Open AccessFileName & "\PreviousPath" For Output Shared As #1
    Print #1, LTrim(AccessFileName)
    Close #1

  'Call ISOKAYTOLUNCH

    If Len(Dir(WhereIsTheDatabase)) = 0 Then

       '================ C R E A T E  S Y S T E M ===============
       ' Get default Workspace.
       Set wrkDefault = DBEngine.Workspaces(0)

       ' Create a new encrypted database with the specified collating order.
       '---------------------------------------------------------------------
       Set AppDataBaseFile = wrkDefault.CreateDatabase(WhereIsTheDatabase, _
                    dbLangGeneral, dbEncrypt)

       '---------------------------------------------------------------------
       ' 0.1. Create System table inside the database.
       Set xTblDefaultName = AppDataBaseFile.CreateTableDef("System_File")
       Set xFldName = xTblDefaultName.CreateField("ID", dbText, 11)
       xFldName.Required = False ' Allow Null value.
       xTblDefaultName.Fields.Append xFldName 'add the field to the table just created.
       xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Department", dbText, 35)
               xFldName.Required = True ' No Null value allowed.
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Status", dbText, 10)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       AppDataBaseFile.TableDefs.Append xTblDefaultName  ' Add System_File table to Database.

       Set Rs_System_file = AppDataBaseFile.OpenRecordset("System_file", , adOpenDynamic)
           Rs_System_file.Close

       '================ E N D   O F   S Y S T E M ===============

       '================ C R E A T E   U S E R   T a b l e ===============
       ' 0.2. Create User table inside the database.
       '---------------------------------------------------------------------
       Set xTblDefaultName = AppDataBaseFile.CreateTableDef("User_File")
       Set xFldName = xTblDefaultName.CreateField("Social_Security_No", dbText, 11)
       xFldName.Required = True ' Allow Null value.
       xTblDefaultName.Fields.Append xFldName 'add the field to the table just created.
       xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Salutation", dbText, 4)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
       
       Set xFldName = xTblDefaultName.CreateField("Last_Name", dbText, 15)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Middle_Name", dbText, 15)
               xFldName.Required = False ' No Null value allowed.
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("First_Name", dbText, 15)
               xFldName.Required = False ' No Null value allowed.
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Nick_Name", dbText, 10)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Cell_Phone", dbText, 12)
               xFldName.Required = False ' No Null value allowed.
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Email_Address", dbText, 30)
               xFldName.Required = False ' No Null value allowed.
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Web_Site", dbText, 30)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Street_Address", dbText)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("City_Name", dbText, 20)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("State_Name", dbText, 3)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Zip_Code", dbText, 9)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
       
       Set xFldName = xTblDefaultName.CreateField("County_Name", dbText, 20)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
               
       Set xFldName = xTblDefaultName.CreateField("Country_Name", dbText, 3)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Phone", dbText, 12)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Fax", dbText, 12)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Date_Created", dbDate)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
       
       Set xFldName = xTblDefaultName.CreateField("status", dbText, 15)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
       
       Set xFldName = xTblDefaultName.CreateField("Pay_rate", dbDouble)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
       
       AppDataBaseFile.TableDefs.Append xTblDefaultName  ' Add User_File table to Database.

       Set Rs_User_file = AppDataBaseFile.OpenRecordset("User_file", , adOpenDynamic)
           Rs_User_file.Close

       
       '================ C R E A T E   T I M E L O G   T A B L E   F I L E ===============
       ' 0.2. Create the time table inside the database called Time_Log.
       '---------------------------------------------------------------------
       Set xTblDefaultName = AppDataBaseFile.CreateTableDef("Time_Log")
       Set xFldName = xTblDefaultName.CreateField("Social_Security_No", dbText, 11)
       xFldName.Required = True ' Allow Null value.
       xTblDefaultName.Fields.Append xFldName 'add the field to the table just created.
       xFldName.AllowZeroLength = False

       Set xFldName = xTblDefaultName.CreateField("Time_In", dbText)
               xFldName.Required = False ' No Null value allowed.
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Date_In", dbDate)
               xFldName.Required = False ' No Null value allowed.
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Time_In_Yes", dbText, 1)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Time_Out", dbText)
               xFldName.Required = False ' No Null value allowed.
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Date_Out", dbDate)
               xFldName.Required = False ' No Null value allowed.
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Time_Out_Yes", dbText, 1)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Time_Total", dbText)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Log_Count", dbText)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
       
       Set xFldName = xTblDefaultName.CreateField("Time_Bonus", dbText)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
       
       Set xFldName = xTblDefaultName.CreateField("Week_No", dbInteger)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       AppDataBaseFile.TableDefs.Append xTblDefaultName  ' Add Rs_Time_Log table to Database.

       Set rS_tIme_log = AppDataBaseFile.OpenRecordset("Time_Log", , adOpenDynamic)
           rS_tIme_log.Close

       '================ C R E A T E   C O U N T R Y   T a b l e ===============
       ' 0.3. Create the User table inside the database called Country.
       '---------------------------------------------------------------------
       Set xTblDefaultName = AppDataBaseFile.CreateTableDef("Country")
       Set xFldName = xTblDefaultName.CreateField("Country_Code", dbText, 3)
       xFldName.Required = True ' Allow Null value.
       xTblDefaultName.Fields.Append xFldName 'add the field to the table just created.
       xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Country_Name", dbText, 50)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

      AppDataBaseFile.TableDefs.Append xTblDefaultName  ' Add Rs_Time_Log table to Database.

       ' Fill_Country_Names
       ' =================================================================
       Call Fill_Country_Names
 
       '================ C R E A T E   S t a t e   T a b l e =============
       ' 0.4. Create the State table inside the database.
       '---------------------------------------------------------------------
       Set xTblDefaultName = AppDataBaseFile.CreateTableDef("State")
       Set xFldName = xTblDefaultName.CreateField("State_Code", dbText, 2)
       xFldName.Required = True ' Allow Null value.
       xTblDefaultName.Fields.Append xFldName 'add the field to the table just created.
       xFldName.AllowZeroLength = False

       Set xFldName = xTblDefaultName.CreateField("State_Name", dbText, 40)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = False
       
       AppDataBaseFile.TableDefs.Append xTblDefaultName  ' Add Rs_Time_Log table to Database.
       
       ' Fill_State_Names
       ' =================================================================
       Call Fill_State_Names
       
       
       '================ C R E A T E   R A T E   T A B L E ===============
       ' 0.5. Create the Rate table inside the database.
       '------------------------------------------------------------------
       Set xTblDefaultName = AppDataBaseFile.CreateTableDef("Rate")
       Set xFldName = xTblDefaultName.CreateField("SOCIAL_SECURITY_NO", dbText, 11)
       xFldName.Required = True ' Allow Null value.
       xTblDefaultName.Fields.Append xFldName 'add the field to the table just created.
       xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Rate", dbDouble)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True

       Set xFldName = xTblDefaultName.CreateField("Hour_Worked", dbDouble)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
       
       Set xFldName = xTblDefaultName.CreateField("Yr_To_Dt_Earning", dbDouble)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
               
       Set xFldName = xTblDefaultName.CreateField("Exemptions", dbDouble)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
               
       Set xFldName = xTblDefaultName.CreateField("Status", dbInteger)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
      
       Set xFldName = xTblDefaultName.CreateField("Date_Created", dbDate)
               xTblDefaultName.Fields.Append xFldName 'add the field to the tabledef
               xFldName.AllowZeroLength = True
      
       AppDataBaseFile.TableDefs.Append xTblDefaultName  ' Add Rs_Time_Log table to Database.
       
       ' ================================================================
       ' Check for the existence of Inifile.ini file in the app location
       ' if app was previously ran...
       ' ================================================================
       If Len(Dir(New_App_Path & "\IniFile.Ini")) = 0 Then
           Open New_App_Path & "\IniFile.Ini" For Output Shared As #1
           Print #1, "1"
           Close #1
       End If
       '================ E N D   O F   Time_Log   Table    F I L E ===============
   
   Else
        Err.Clear
        'On Error Resume Next
        'If Dir(WhereIsTheDatabase) <> "" Then
        '    DBEngine.RepairDatabase WhereIsTheDatabase
        'End If
        Set AppDataBaseFile = OpenDatabase(WhereIsTheDatabase, False) ' Open database

        ' On Erorr GoTo fileErroroutput:
        ' ================================================================
        ' Check for the existence of Inifile.ini file in the app location
        ' if app was previously ran...
        ' ================================================================
        If Len(Dir(New_App_Path & "\IniFile.Ini")) = 0 Then
            Open New_App_Path & "\IniFile.Ini" For Output Shared As #1
            Print #1, "1"
            Close #1
        End If

        ' ===============================================================
        ' Open IniFile.ini file in the app location
        ' ===============================================================
        Dim data_x2 As String
        Open New_App_Path & "\IniFile.Ini" For Input Shared As #1
        Do While Not EOF(1)
            If Not EOF(1) Then
                Line Input #1, data_x2
                If Len(data_x2) <> 0 Or data_x2 <> "" Then
                    Daylimit = Val(data_x2)
                Else
                    Daylimit = "2"
                End If
            ElseIf EOF(1) Then
                Exit Do
            End If
        Loop
        Close #1
    End If
End Sub

' Fill Country and codes name in the database table...
' ====================================================
Public Sub Fill_Country_Names()
    Dim rs_Country
    Set rs_Country = _
        AppDataBaseFile.OpenRecordset("SELECT * FROM Country")
    With rs_Country
        .AddNew
            .Fields!("Country_code") = "AF"
            .Fields!("Country_NAME") = "Afghanistan"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AL"
            .Fields!("Country_NAME") = "Albania"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "DZ"
            .Fields!("Country_NAME") = "Algeria"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AS"
            .Fields!("Country_NAME") = "American Samoa"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AD"
            .Fields!("Country_NAME") = "Andorra"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AO"
            .Fields!("Country_NAME") = "Angola"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AI"
            .Fields!("Country_NAME") = "Anguilla"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AQ"
            .Fields!("Country_NAME") = "Antarctica"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AG"
            .Fields!("Country_NAME") = "Antigua And Barbuda"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AR"
            .Fields!("Country_NAME") = "Argentina"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AM"
            .Fields!("Country_NAME") = "Armenia"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AW"
            .Fields!("Country_NAME") = "Aruba"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AU"
            .Fields!("Country_NAME") = "Australia"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AT"
            .Fields!("Country_NAME") = "Austria"
        .Update
        
        .AddNew
            .Fields!("Country_code") = "AZ"
            .Fields!("Country_NAME") = "Azerbaijan"
        .Update
        .AddNew
            .Fields!("Country_code") = "BH"
            .Fields!("Country_NAME") = "Bahrain"
        .Update
        .AddNew
            .Fields!("Country_code") = "BD"
            .Fields!("Country_NAME") = "Bangladesh"
        .Update
        .AddNew
            .Fields!("Country_code") = "BB"
            .Fields!("Country_NAME") = "Barbados"
        .Update
        .AddNew
            .Fields!("Country_code") = "By"
            .Fields!("Country_NAME") = "Belarus"
        .Update
        .AddNew
            .Fields!("Country_code") = "BE"
            .Fields!("Country_NAME") = "Belgium"
        .Update
        .AddNew
            .Fields!("Country_code") = "BZ"
            .Fields!("Country_NAME") = "Belize"
        .Update
        .AddNew
            .Fields!("Country_code") = "BJ"
            .Fields!("Country_NAME") = "Benin"
        .Update
        .AddNew
            .Fields!("Country_code") = "BM"
            .Fields!("Country_NAME") = "Bermuda"
        .Update
        .AddNew
            .Fields!("Country_code") = "BT"
            .Fields!("Country_NAME") = "Bhutan"
        .Update
        .AddNew
            .Fields!("Country_code") = "BO"
            .Fields!("Country_NAME") = "Bolivia"
        .Update
        .AddNew
            .Fields!("Country_code") = "BA"
            .Fields!("Country_NAME") = "Bosnia And Herzegovina"
        .Update
        .AddNew
            .Fields!("Country_code") = "BW"
            .Fields!("Country_NAME") = "Botswana"
        .Update
        .AddNew
            .Fields!("Country_code") = "BV"
            .Fields!("Country_NAME") = "Bouvet Island"
        .Update
        .AddNew
            .Fields!("Country_code") = "BR"
            .Fields!("Country_NAME") = "Brazil"
        .Update
        .AddNew
            .Fields!("Country_code") = "IO"
            .Fields!("Country_NAME") = "British Indian Ocean Territory"
        .Update
        .AddNew
            .Fields!("Country_code") = "VG"
            .Fields!("Country_NAME") = "British Virgin Islands"
        .Update
        .AddNew
            .Fields!("Country_code") = "BN"
            .Fields!("Country_NAME") = "Brunei Darussalam"
        .Update
        .AddNew
            .Fields!("Country_code") = "BG"
            .Fields!("Country_NAME") = "Bulgaria"
        .Update
        .AddNew
            .Fields!("Country_code") = "BF"
            .Fields!("Country_NAME") = "Burkina Faso"
        .Update
        .AddNew
            .Fields!("Country_code") = "MM"
            .Fields!("Country_NAME") = "Burma"
        .Update
        .AddNew
            .Fields!("Country_code") = "BI"
            .Fields!("Country_NAME") = "Burundi"
        .Update
        .AddNew
            .Fields!("Country_code") = "KH"
            .Fields!("Country_NAME") = "Cambodia"
        .Update
        .AddNew
            .Fields!("Country_code") = "CM"
            .Fields!("Country_NAME") = "Cameroon"
        .Update
        .AddNew
            .Fields!("Country_code") = "CA"
            .Fields!("Country_NAME") = "Canada"
        .Update
        .AddNew
            .Fields!("Country_code") = "CV"
            .Fields!("Country_NAME") = "Cape Verde"
        .Update
        .AddNew
            .Fields!("Country_code") = "KY"
            .Fields!("Country_NAME") = "Cayman Islands"
        .Update
        .AddNew
            .Fields!("Country_code") = "CF"
            .Fields!("Country_NAME") = "Central African Republic"
        .Update
        .AddNew
            .Fields!("Country_code") = "TD"
            .Fields!("Country_NAME") = "Chad"
        .Update
        .AddNew
            .Fields!("Country_code") = "CL"
            .Fields!("Country_NAME") = "Chile"
        .Update
        .AddNew
            .Fields!("Country_code") = "CN"
            .Fields!("Country_NAME") = "China"
        .Update
        .AddNew
            .Fields!("Country_code") = "CX"
            .Fields!("Country_NAME") = "Christmas Island"
        .Update
        .AddNew
            .Fields!("Country_code") = "CC"
            .Fields!("Country_name") = "Cocos (Keeling) Islands"
        .Update
        .AddNew
            .Fields!("Country_code") = "CO"
            .Fields!("Country_name") = "Colombia"
        .Update
        .AddNew
            .Fields!("Country_code") = "KM"
            .Fields!("Country_name") = "Comoros"
        .Update
        .AddNew
            .Fields!("Country_code") = "CD"
            .Fields!("Country_name") = "Congo, Democratic Republic of the"
        .Update
        .AddNew
            .Fields!("Country_code") = "CG"
            .Fields!("Country_name") = "Congo, Republic of the"
        .Update
        .AddNew
            .Fields!("Country_code") = "CK"
            .Fields!("Country_name") = "Cook Islands"
        .Update
        .AddNew
            .Fields!("Country_code") = "CR"
            .Fields!("Country_name") = "Costa Rica"
        .Update
        .AddNew
            .Fields!("Country_code") = "CI"
            .Fields!("Country_name") = "Cote d'Ivoire"
        .Update
        .AddNew
            .Fields!("Country_code") = "HR"
            .Fields!("Country_name") = "Croatia"
        .Update
        .AddNew
            .Fields!("Country_code") = "CU"
            .Fields!("Country_name") = "Cuba"
        .Update
        .AddNew
            .Fields!("Country_code") = "CY"
            .Fields!("Country_name") = "Cyprus"
        .Update
        .AddNew
            .Fields!("Country_code") = "CZ"
            .Fields!("Country_name") = "Czech Republic"
        .Update
        .AddNew
            .Fields!("Country_code") = "DK"
            .Fields!("Country_name") = "Denmark"
        .Update
        .AddNew
            .Fields!("Country_code") = "DJ"
            .Fields!("Country_name") = "Djibouti"
        .Update
        .AddNew
            .Fields!("Country_code") = "DM"
            .Fields!("Country_name") = "Dominica"
        .Update
        .AddNew
            .Fields!("Country_code") = "DO"
            .Fields!("Country_name") = "Dominican Republic"
        .Update
        .AddNew
            .Fields!("Country_code") = "TP"
            .Fields!("Country_name") = "East Timor"
        .Update
        .AddNew
            .Fields!("Country_code") = "EC"
            .Fields!("Country_name") = "Ecuador"
        .Update
        .AddNew
            .Fields!("Country_code") = "EG"

Download this snippet    Add to My Saved Code

Create database, tables, states, countries, format phone, format social security number Comments

No comments have been posted about Create database, tables, states, countries, format phone, format social security number. Why not be the first to post a comment about Create database, tables, states, countries, format phone, format social security number.

Post your comment

Subject:
Message:
0/1000 characters