(495) 925-0049, ITShop - 229-0436, 925-0049
 

 
 
 
 
 

Access

, MS Access .

:

  • CM_LT_AddAllExt()- mdb
  • CM_LT_AddAllExt_ODBC()- ODBC
  • CM_LT_DelAll()- -

. . , .

:

view plain copy to clipboard print
  1. PublicFunctionCM_LT_AddAllExt(ByValstPathToBaseAsString)AsLong
  2. '<..>:2004-02-05
  3. '
  4. ',.
  5. '.(),
  6. '..
  7. ':stPathToBase-
  8. ':,-1
  9. OnErrorGoToErr_
  10. CM_LT_AddAllExt=0
  11. DimtdfAsTableDef
  12. DimdbAsDatabase
  13. DimbIsSysOrLinkAsBoolean
  14. DimstNameTblAsString
  15. DimlCountNotLinketAsLong'
  16. DimstConnectAsString
  17. DimdbCurAsDAO.Database
  18. DimtdfNewAsDAO.TableDef
  19. DimtdfsCurAsDAO.TableDefs
  20. stConnect=";DATABASE="&stPathToBase
  21. SetdbCur=CurrentDb
  22. SettdfsCur=dbCur.TableDefs
  23. '--堠
  24. DimmasNameTbl()AsString
  25. DimiAsLong
  26. tdfsCur.Refresh
  27. ReDimmasNameTbl(tdfsCur.count-1)
  28. i=0
  29. ForEachtdfIntdfsCur
  30. masNameTbl(i)=tdf.Name
  31. i=i+1
  32. Nexttdf
  33. '--堠
  34. Setdb=OpenDatabase(stPathToBase)
  35. lCountNotLinket=0
  36. '--젠
  37. ForEachtdfIndb.TableDefs
  38. bIsSysOrLink=(tdf.AttributesAnddbSystemObject)Or_
  39. (tdf.AttributesAnddbHiddenObject)_
  40. Or(tdf.AttributesAnddbAttachedTable)'?
  41. IfNotbIsSysOrLinkThen',ꠠ
  42. stNameTbl=tdf.Name
  43. '--堠
  44. IfSerchStrInMas(masNameTbl,stNameTbl)<>-1Then
  45. '--?
  46. If(tdfsCur(stNameTbl).AttributesAnddbAttachedTable)Then
  47. '--䠠
  48. tdfsCur(stNameTbl).Connect=stConnect
  49. tdfsCur(stNameTbl).RefreshLink
  50. Else
  51. Debug.Print"CM_LT_AddAllExt(),:",stNameTbl
  52. lCountNotLinket=lCountNotLinket+1
  53. EndIf
  54. Else
  55. '---젠
  56. SettdfNew=dbCur.CreateTableDef(stNameTbl)
  57. tdfNew.SourceTableName=stNameTbl
  58. tdfNew.Connect=stConnect
  59. tdfsCur.AppendtdfNew
  60. EndIf
  61. EndIf
  62. Nexttdf
  63. db.Close
  64. Setdb=Nothing
  65. tdfsCur.Refresh
  66. SettdfsCur=Nothing
  67. SetdbCur=Nothing
  68. CM_LT_AddAllExt=lCountNotLinket
  69. Exit_:
  70. ExitFunction
  71. Err_:
  72. CM_LT_AddAllExt=-1
  73. Err.RaiseErr.Number,"CM_LT_AddAllExt()->"&Err.Source,Err.Description'--
  74. ResumeExit_
  75. EndFunction
  76. PrivateFunctionSerchStrInMas(ByRefmasStr()AsString,ByRefSerchStrAsString)AsLong
  77. '<..>:2004-02-05
  78. '堠
  79. ':masStr-ꠠ
  80. 'SerchStr-ࠠ
  81. ':
  82. ',SerchStr,-1()
  83. '-1
  84. OnErrorGoToErr_
  85. DimiAsLong
  86. SerchStrInMas=-1
  87. Fori=LBound(masStr)ToUBound(masStr)
  88. IfmasStr(i)=SerchStrThen
  89. SerchStrInMas=i
  90. ExitFor
  91. EndIf
  92. Nexti
  93. Exit_:
  94. ExitFunction
  95. Err_:
  96. SerchStrInMas=-1
  97. ResumeExit_
  98. EndFunction
  99. PublicFunctionCM_LT_AddAllExt_ODBC(ByValstConnectStrAsString)AsLong
  100. '<..>:2006-10-12
  101. '
  102. ',.
  103. ',
  104. '..,ࠠ
  105. ':stConnectStr-ADO
  106. ':,-1
  107. OnErrorGoToErr_
  108. CM_LT_AddAllExt_ODBC=0
  109. DimbIsSysOrLinkAsBoolean
  110. DimstNameTblAsString
  111. DimtdfAsTableDef
  112. DimlCountNotLinketAsLong'
  113. DimcnnAsADODB.Connection
  114. DimrstAsADODB.Recordset
  115. DimstConnectTblAsString
  116. DimdbCurAsDAO.Database
  117. DimtdfNewAsDAO.TableDef
  118. DimtdfsCurAsDAO.TableDefs
  119. stConnectTbl="ODBC;"&stConnectStr
  120. SetdbCur=CurrentDb
  121. SettdfsCur=dbCur.TableDefs
  122. '堠
  123. DimmasNameTbl()AsString
  124. DimiAsLong
  125. ReDimmasNameTbl(tdfsCur.count-1)
  126. i=0
  127. ForEachtdfIntdfsCur
  128. masNameTbl(i)=tdf.Name
  129. i=i+1
  130. Nexttdf
  131. '堠
  132. Setcnn=NewADODB.Connection
  133. cnn.Open(stConnectStr)
  134. Setrst=cnn.OpenSchema(adSchemaTables)
  135. lCountNotLinket=0
  136. '젠
  137. DoWhileNotrst.EOF
  138. stNameTbl=rst("TABLE_NAME")
  139. '堠
  140. IfSerchStrInMas(masNameTbl,stNameTbl)<>-1Then
  141. '?
  142. If(tdfsCur(stNameTbl).AttributesAnd(dbAttachedTable+dbAttachedODBC))Then
  143. '--䠠
  144. tdfsCur(stNameTbl).Connect=stConnectTbl
  145. tdfsCur(stNameTbl).RefreshLink
  146. Else
  147. Debug.Print"CM_LT_AddAllExt_ODBC(),:",stNameTbl
  148. lCountNotLinket=lCountNotLinket+1
  149. EndIf
  150. Else
  151. '---젠
  152. SettdfNew=dbCur.CreateTableDef(stNameTbl)
  153. tdfNew.SourceTableName=stNameTbl
  154. tdfNew.Connect=stConnectTbl
  155. tdfsCur.AppendtdfNew
  156. EndIf
  157. rst.MoveNext
  158. Loop
  159. tdfsCur.Refresh
  160. SettdfsCur=Nothing
  161. SetdbCur=Nothing
  162. rst.Close
  163. cnn.Close
  164. CM_LT_AddAllExt_ODBC=lCountNotLinket
  165. Exit_:
  166. ExitFunction
  167. Err_:
  168. Err.RaiseErr.Number,"CM_LT_AddAllExt_ODBC()->"&Err.Source,Err.Description'--
  169. CM_LT_AddAllExt_ODBC=-1
  170. ResumeExit_
  171. EndFunction
  172. PublicFunctionCM_LT_DelAll()AsBoolean
  173. '<..>:2003-12-12
  174. '堠
  175. OnErrorGoToErr_
  176. DimtdfAsTableDef
  177. DimdbAsDatabase
  178. DimbIsAttachedAsBoolean
  179. Setdb=CurrentDb
  180. ForEachtdfIndb.TableDefs
  181. bIsAttached=(tdf.AttributesAnddbAttachedODBC)_
  182. Or(tdf.AttributesAnddbAttachedTable)'ODBC
  183. IfbIsAttachedThen'堠
  184. DoCmd.DeleteObjectacTable,tdf.Name
  185. EndIf
  186. Next
  187. Setdb=Nothing
  188. CM_LT_DelAll=True
  189. Exit_:
  190. ExitFunction
  191. Err_:
  192. CM_LT_DelAll=False
  193. Err.RaiseErr.Number,"CM_LT_DelAll()->"&Err.Source,Err.Description'--
  194. ResumeExit_
  195. EndFunction

!



  »
   »
     »
 
  » : 23.06.2011 
 

   WWW.ITSHOP.RU
Rational ClearCase Multisite Floating User License
DevExpress / DXperience Subscription
Oracle Database Standard Edition 2 Named User Plus License
Microsoft Office 365 . 1 1
EMS SQL Management Studio for InterBase/Firebird (Business) + 1 Year Maintenance
 
...
 
   WWW.ITSHOP.RU
 
...
 
   WWW.ITSHOP.RU
 
...
 
3D | 3D    WWW.ITSHOP.RU
 
...
 
 
 Subscribe.ru
: CASE, RAD, ERP, OLAP
Microsoft Access
CASE-
OS Linux . + + +
Oracle " "
Delphi -
 
 
Download
 
 
 
? (9)
, , ...
 
Windows 10 (2)
! Windows 10, , ...
 
ErWin to Access Relation Error (2)
! ErWin ss : ERwinDatabase.Relations.Append...
 
MS Access (331)
. , OLAP. , ...
 
(1)
. "" " ...
 
 
 



    
rambler's top100 Rambler's Top100