home *** CD-ROM | disk | FTP | other *** search
Wrap
VERSION 5.00 Object = "*\A..\PrjDBImport.vbp" Begin VB.Form frmTest BorderStyle = 3 'Fixed Dialog Caption = "DBImport Demo" ClientHeight = 3825 ClientLeft = 2835 ClientTop = 2490 ClientWidth = 4245 Icon = "frmTest.frx":0000 LinkTopic = "Form1" MaxButton = 0 'False MinButton = 0 'False ScaleHeight = 3825 ScaleWidth = 4245 Begin DBImportActiveX.DBImport DBImport1 Height = 345 Left = 1890 TabIndex = 7 Top = 3300 Visible = 0 'False Width = 300 _ExtentX = 529 _ExtentY = 609 End Begin VB.ComboBox Combo1 Height = 315 ItemData = "frmTest.frx":030A Left = 2250 List = "frmTest.frx":031A Style = 2 'Dropdown List TabIndex = 3 Top = 2880 Width = 1905 End Begin VB.DriveListBox Drive1 Height = 315 Left = 120 TabIndex = 2 Top = 2880 Width = 1905 End Begin VB.FileListBox File1 Height = 2040 Left = 2220 Pattern = "*.MDB" TabIndex = 1 Top = 630 Width = 1932 End Begin VB.CommandButton Command2 Cancel = -1 'True Caption = "Close" Height = 375 Left = 480 TabIndex = 4 Top = 3330 Width = 1335 End Begin VB.DirListBox Dir1 Height = 2115 Left = 108 TabIndex = 0 Top = 630 Width = 1935 End Begin VB.CommandButton cmdImport Caption = "Import" Height = 375 Left = 2460 TabIndex = 6 Top = 3330 Width = 1335 End Begin VB.Label Label1 Caption = "Select any Table to which you want to import data, and click on 'Import'" Height = 435 Left = 120 TabIndex = 5 Top = 120 Width = 3990 End Attribute VB_Name = "frmTest" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Option Explicit Dim connect As TypeConnect Sub import() ' DBImport1.MultiTable = True Select Case Combo1.ListIndex Case 0 ' access database : let the user choose the table to export (MultiTable=True) DBImport1.DatabaseName = Dir1.Path & "\" & File1.filename Case 1, 2 ' PDox or DBase, export one table at a time (MultiTable=False) DBImport1.DatabaseName = Dir1.Path DBImport1.TableName = File1.filename Case Else 'ODBC frmODBCLogon.Show vbModal If frmODBCLogon.bOk Then DBImport1.DSN = frmODBCLogon.cboDSNList.Text DBImport1.UserName = frmODBCLogon.txtUID DBImport1.Password = frmODBCLogon.txtPWD DBImport1.DatabaseName = frmODBCLogon.txtDatabase Else Exit Sub End If End Select DBImport1.ConnectString = connect DBImport1.IniFile = App.Path & "\ExportSettings.ini" DBImport1.Execute End Sub Private Sub cmdImport_Click() import End Sub Private Sub Combo1_Click() Select Case Combo1.ListIndex Case 0 File1.Pattern = "*.MDB" connect = Access Case 1 File1.Pattern = "*.DB" connect = Paradox5 Case 2 File1.Pattern = "*.DBF" connect = DBase5 Case 3 connect = ODBC End Select End Sub Private Sub Command1_Click() End Sub Private Sub Command2_Click() Unload Me End Sub Private Sub DBImport1_BeforeFieldImport(ByVal TableName As String, ByVal FieldName As String, ByVal FieldType As Integer, ByVal FieldSize As Integer, bufField As String) If FieldName = "Fax" And bufField = "" Then bufField = "00.00.00.00.00" End Sub Private Sub Dir1_Change() File1.Path = Dir1.Path ' Set file path. End Sub Private Sub Drive1_Change() Dir1.Path = Drive1.Drive ' Set directory path. End Sub Private Sub File1_DblClick() import End Sub Private Sub Form_Load() Dim iTop%, iLeft% Combo1.ListIndex = 0 ' Center the Form iTop = (Screen.Height - Height) \ 2 If iTop < 0 Then iTop = 0 iLeft = (Screen.Width - Width) \ 2 If iLeft < 0 Then iLeft = 0 Move iLeft, iTop End Sub