?? module_quh.bas
字號:
Attribute VB_Name = "Module_QUH"
'****************************************************************
Option Explicit
Public db As Database
Public gstdatabase As String 'GPS下載文件
Public gstNewdatabase As String 'ARC Project程序能接受的輸入文件
Public gstdatabaseAlbers As String 'ARC Project程序的輸出文件
Public gstNewdatabaseAlbers As String 'Arcview能接受的文本文件
Public Declare Function DeleteFile Lib "kernel32" Alias "DeleteFileA" (ByVal lpFileName As String) As Long
Public Function GetNewDataBaseAlbers(a_Name As Form) As String
'Arcview能接受的文本文件
Dim ip As Integer, stmess As String
On Error GoTo HandleError
'建立用戶指定文件名的數據文件
With a_Name.dlgDatabase
.DialogTitle = "新建Arcview的輸入文件"
.CancelError = False
'ToDo: 設置 common dialog 控件的標志和屬性
.Filter = "Database files (*.txt)|*.txt" '|All files (*.*)|*.*"
.ShowOpen
If Len(.FileName) = 0 Then
Exit Function
End If
GetNewDataBaseAlbers = .FileName
End With
If Dir(GetNewDataBaseAlbers) <> "" Then
stmess = MsgBox(GetNewDataBaseAlbers & "已經存在!覆蓋它?", vbYesNo)
If stmess = vbYes Then
DeleteFile (GetNewDataBaseAlbers) '先刪除然后再建立
Else
Exit Function
End If
End If
SubExit:
Exit Function
HandleError:
Select Case Err.Number
Case 3004, 3024, 3044
If GetNewDataBaseAlbers = "" Then
MsgBox "No database was selected.", vbExclamation, " Database Error "
Resume 'open the database
End If
Case Else
End ' exit the project
End Select
End Function
Public Function GetNewDataBase(a_Name As Form) As String
Dim ip As Integer, stmess As String
On Error GoTo HandleError
'建立用戶指定文件名的數據文件
With a_Name.dlgDatabase
.DialogTitle = "新建ARC Project 的輸入文件"
.CancelError = False
'ToDo: 設置 common dialog 控件的標志和屬性
.Filter = "Database files (*.txt)|*.txt" '|All files (*.*)|*.*"
.ShowOpen
If Len(.FileName) = 0 Then
Exit Function
End If
GetNewDataBase = .FileName
End With
If Dir(GetNewDataBase) <> "" Then
stmess = MsgBox(GetNewDataBase & "已經存在!覆蓋它?", vbYesNo)
If stmess = vbYes Then
DeleteFile (GetNewDataBase) '先刪除然后再建立
Else
Exit Function
End If
End If
SubExit:
Exit Function
HandleError:
Select Case Err.Number
Case 3004, 3024, 3044
If gstNewdatabase = "" Then
MsgBox "No database was selected.", vbExclamation, " Database Error "
Else
Set db = OpenDatabase(gstNewdatabase) 'new database location
Resume 'open the database
End If
Case Else
End ' exit the project
End Select
End Function
Public Function GetDatabase(a_Name As Form) As String
Dim iResp As Integer
Dim stMsg As String, ip As Integer
On Error GoTo ErrHandler
With a_Name.dlgDatabase
.DialogTitle = "打開GPS下載文件"
.CancelError = True
.FileName = App.Path & "\*.txt" ' gstNewDatabase
.Filter = "Database files (*.txt)|*.txt|All files(*.*)|*.*"
.ShowOpen
If Err.Number = cdlCancel Then
GetDatabase = ""
GoTo Handler1
Else
GetDatabase = .FileName
End If
End With
Handler1:
Exit Function
ErrHandler:
' 用戶按了“取消”按鈕
Dim stmess As String
Select Case Err.Number
Case 3078 ' duplicate key fie1d
stmess = "這個數據庫文件不是本系統需要的數據庫文件 "
MsgBox stmess, vbExclamation, "數據庫錯誤"
GetDatabase = ""
Exit Function
Case Else
Exit Function
End Select
End Function
Public Function GetDatabaseAlbers(a_Name As Form) As String
'ARC Project程序的輸出文件
Dim iResp As Integer
Dim stMsg As String, ip As Integer
On Error GoTo ErrHandler
With a_Name.dlgDatabase
.DialogTitle = "打開ARC Project的輸出文件"
.CancelError = True
.FileName = App.Path & "\*.txt" ' gstNewDatabase
.Filter = "Database files (*.txt)|*.txt|All files(*.*)|*.*"
.ShowOpen
If Err.Number = cdlCancel Then
GetDatabaseAlbers = ""
GoTo Handler1
Else
GetDatabaseAlbers = .FileName
End If
End With
Handler1:
Exit Function
ErrHandler:
' 用戶按了“取消”按鈕
Dim stmess As String
Select Case Err.Number
Case 3078 ' duplicate key fie1d
stmess = "這個數據庫文件不是本系統需要的數據庫文件 "
MsgBox stmess, vbExclamation, "數據庫錯誤"
GetDatabaseAlbers = ""
Exit Function
Case Else
Exit Function
End Select
End Function
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -