Exemplo de criação de uma tabela chamada tblARPDetail. Requer referência a ADOx.
Public Sub ADOXCreateDetailTable()Dim cat As New ADOX.CatalogDim tbl As ADOX.tableSet cat.ActiveConnection = CurrentProject.ConnectionOn Error Resume NextSet tbl = cat.Tables("tblARPDetail")If tbl Is Nothing ThenElsecat.Tables.Delete "tblARPDetail"Set tbl = NothingEnd IfSet tbl = New ADOX.tablecat.Tables.Delete "tblARPDetail"tbl.Name = "tblARPDetail"With tbl.Columns.Append "dtmPayableDate", adDate.Append "strPrefix", adVarWChar, 3.Append "strCheckNumber", adVarWChar, 13.Append "curAmount", adCurrency.Append "strLoanAccount", adVarWChar, 12.Append "strShortName", adWChar, 40.Append "strCity", adVarWChar, 40.Append "strState", adVarWChar, 2.Append "strZip", adVarWChar, 12.Append "strName", adVarWChar, 40.Append "strAddress1", adVarWChar, 40.Append "strAddress2", adVarWChar, 40.Append "strAddress3", adVarWChar, 40.Append "strAddress4", adVarWChar, 40.Append "strSSN", adVarWChar, 12.Append "strInternalNumber", adVarWChar, 12.Append "strLoanNumber", adVarWChar, 12.Append "strDatabase", adVarWChar.Append "strLoanType", adVarWChar, 4.Append "strPayeeNumber", adVarWChar.Append "bolForeign", adBoolean.Append "bolEligible", adBoolean.Append "bolLump", adBoolean.Append "bolDueDiligence", adBooleanWith !dtmPayableDateSet .ParentCatalog = cat.Properties("Description") = "Payable Date"End WithWith !strPrefixSet .ParentCatalog = cat.Properties("Description") = "Check Prefix".Properties("AllowZeroLength") = TrueEnd WithWith !strCheckNumberSet .ParentCatalog = cat.Properties("Description") = "Check Number"End WithWith !curAmountSet .ParentCatalog = cat.Properties("Description") = "Check Face Amount"End WithWith !strLoanAccountSet .ParentCatalog = cat.Properties("Description") = "Hogan Account"End WithWith !strShortNameSet .ParentCatalog = cat.Properties("Description") = "BondMaster Loan Short Name"End WithWith !strCitySet .ParentCatalog = cat.Properties("Description") = "Payee City"End WithWith !strStateSet .ParentCatalog = cat.Properties("Description") = "Payee State"End WithWith !strZipSet .ParentCatalog = cat.Properties("Description") = "Payee Zip"End WithWith !strNameSet .ParentCatalog = cat.Properties("Description") = "Payee Name"End WithWith !strAddress1Set .ParentCatalog = cat.Properties("Description") = "Payee Address Line 1"End WithWith !strAddress2Set .ParentCatalog = cat.Properties("Description") = "Payee Address Line 2"End WithWith !strAddress3Set .ParentCatalog = cat.Properties("Description") = "Payee Address Line 3"End WithWith !strAddress4Set .ParentCatalog = cat.Properties("allowzerolength") = TrueEnd WithWith !strSSNSet .ParentCatalog = cat.Properties("Description") = "Payee SSN"End WithWith !strLoanNumberSet .ParentCatalog = cat.Properties("Description") = "BondMaster Internal Loan Number"End WithWith !strDatabaseSet .ParentCatalog = cat.Properties("Description") = "BondMaster Database"End WithWith !strLoanTypeSet .ParentCatalog = cat.Properties("Description") = "BondMaster Loan Type (Corp = 5 and Muni = 2)"End WithWith !strPayeeNumberSet .ParentCatalog = cat.Properties("Description") = "BondMaster Payee Number"End WithEnd Withcat.Tables.Append tblSet tbl = NothingSet cat = NothingEnd Sub
Deixe os seus comentários! Envie este artigo, divulgue este link na sua rede social...
ADO, ADOX
Tags: VBA, Tips,
Nenhum comentário:
Postar um comentário