|
인터넷에서 아래와 같은 VB 소스를 찾았습니다.
Private Sub Command4_Click()
Dim cat As New Catalog
Dim cnn As New Connection
Dim t As ADOX.Table
s = “C:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb”
d = “c:\x.mdb”
m = “Microsoft Access”
cnn.Open “provider=Microsoft.jet.oledb.4.0.;data source=”& s
Set cat.ActiveConnection = cnn
Set a = New Access.Application
a.OpenCurrentDatabase s
For Each t In cat.Tables
If Not t.Name Like “MSys*”Then
t2 = t.Name
a.DoCmd.TransferDatabase acExport, m, d, acTable, t2, t2
End If
Next t
cnn.Close
Set cnn = Nothing
Set cat = Nothing
Set a = Nothing
End Sub
그리고... Access에서 다음과 같은 매크로를 통해서... 데이터 내보내기 (dbf로 내보내기)를 얻어 내었습니다.
Function Macro1()
On Error GoTo Macro1_Err
DoCmd.TransferDatabase acExport, "dBase III", "c:\", acTable, "KIWI", "KIWI.dbf", False
Macro1_Exit:
Exit Function
Macro1_Err:
MsgBox Error$
Resume Macro1_Exit
End Function
그래서 제가 직접해볼려구... 구문을 짰는데 역시나 에러가 ^^;;;
void __fastcall TfrmMain::Button1Click(TObject *Sender)
{
Variant oleMA;
try
{
oleMA = Variant::CreateObject("Access.Application");
}
catch(...)
{
return;
}
oleMA.OleFunction("OpenCurrentDatabase", "D:\\POI 데이터\\참조데이터\\DVD_KIWI코드.mdb");
Variant oleDoCmd;
oleDoCmd = oleMA.OlePropertyGet("DoCmd");
//아래 구문 수행시 "유형이 일치하지 않습니다." 라는 메시지가 뜹니다.
oleDoCmd.OleFunction("TransferDatabase", "acExport", "\"dBase III\"", "\"c:\\\"", "acTable", "\"KIWI\"", "\"KIWI.dbf\"", "False");
// 아래 처럼 해도 에러가.. 어떻게 해야 할지요..
oleDoCmd.OleFunction("TransferDatabase", "acExport", "dBase III", "c:\\", "acTable", "KIWI", "KIWI.dbf", "False");
oleMA = Unassigned;
}
한번 해보고 싶었는데 제가 Builder는 잘 안써봐서 어찌 해야 할지 모르겠습니다. 고수님의 손길을 고대하며~~
|