📄 10548.html
字号:
<html>
<head>
<title>Re: 建立资料库 ??</title>
</head>
<body bgcolor="#FFFFFF" vlink="#808080">
<center>
<h1>Re: 建立资料库 ??</h1>
</center>
<hr size=7 width=75%>
<hr size=7 width=75%><p>
Posted by <a href="mailto:richard.pang@hongkong.com">Richard</a> on March 03, 1999 at 02:18:14:<p>
In Reply to: <a href="10540.html">Re: 建立资料库</a> posted by ChenLu on March 02, 1999 at 20:27:28:<p>
: : 请教一下各位高手<br>: : 我想要用原有的资料库从其中抓取一些栏位然后令存成一个资料库<br>: : 利用Crystal Report来读取新建立的资料库,这样我的报表就能动态的显示<br>: : 资料,现在我有一个问题,就是如何从原有的资料库新建立一个资料库,<br>: : 我不太懂他的语法可不可以帮忙一下<p>: : 先谢谢您的帮忙<p>: 试试看<br>: <br>: Dim wks As Workspace<br>: Dim dbNew As Database<br>: Dim tdfNew As TableDef<br>: Dim intFldType As Integer<br>: Dim strFldName As String<br>: Dim intSize As Integer<br>: Dim i As Integer<br>: <br>: 'Your old table<br>: Dim rsOld As Recordset<p>: Set wks = DBEngine.Workspaces(0)<br>: Set dbNew = wks.CreateDatabase("c:\tmp\Test.mdb", dbLangGeneral)<br>: <br>: If dbNew Is Nothing Then<br>: Else<br>: Set tdfNew = dbNew.CreateTableDef("NewTable")<br>: End If<br>: <br>: strFldName = ""<br>: 'pick up your old table fields & append to new table<br>: With rsOld<br>: For i = 0 To .Fields.Count - 1<br>: strFldName = .Fields(i).Name<br>: intFldType = .Fields(i).Type<br>: If intFldType = dbText Then<br>: intSize = .Fields(i).Size<br>: End If<br>: <br>: With tdfNew<br>: If intFldType = dbText Then<br>: .Fields.Append .CreateField(strFldName, intFldType, intSize)<br>: Else<br>: .Fields.Append .CreateField(strFldName, intFldType)<br>: End If<br>: End With<br>: Next i<br>: End With<br>: <br>: dbNew.TableDefs.Append tdfNew<br>: ............................<br>: ........................<p>But create a tmp database will have a problem of same repeated mdb name in application or many tmp files/waste in hard disk due to accidentally power off.<br>Could I also ask how can I create a cursor like table in VB?<p><p>
<br>
<br><hr size=7 width=75%><p>
<a name="followups">Follow Ups:</a><br>
<ul><!--insert: 10548-->
</ul><!--end: 10548-->
<br><hr size=7 width=75%><p>
</body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -