?? module1.bas
字號:
Attribute VB_Name = "Module1"
Option Explicit
Public strusername As String '用戶登錄姓名
Public iflag As Integer
Public ichangeflag As Integer
Public strpublicsql As String
Public userpassword As String '用戶登錄密碼
Public Function getrs(ByVal sql As String, ByVal databasename As String) As ADODB.Recordset
Dim con As ADODB.Connection
Dim rs As ADODB.Recordset
Dim strconnection As String
Dim strarray() As String
Set con = New ADODB.Connection
Set rs = New ADODB.Recordset
On Error GoTo getrs_error
strconnection = "Provider=Microsoft.jet.oledb.4.0;Data Source=" & App.Path & "\"
strconnection = strconnection & databasename & ".mdb"
strarray = Split(sql)
con.Open strconnection
rs.Open Trim$(sql), con, adOpenKeyset, adLockOptimistic
Set getrs = rs
iflag = 1
getrs_exit:
Set rs = Nothing
Set con = Nothing
Exit Function
getrs_error:
MsgBox "查詢錯誤:" & Err.Description
iflag = 2
Resume getrs_exit
End Function
Public Sub transactsql(ByVal sql As String, ByVal databasename As String) '添加執行SQL語句命令的函數
Dim con As ADODB.Connection
Dim strconnection As String
Dim strarray() As String
Set con = New ADODB.Connection
On Error GoTo transactsql_error
strconnection = "Provider=Microsoft.jet.oledb.4.0;Data Source=" & App.Path & "\"
strconnection = strconnection & databasename & ".mdb"
strarray = Split(sql)
con.Open strconnection
con.Execute sql
iflag = 1
transactsql_exit:
Set con = Nothing
Exit Sub
transactsql_error:
MsgBox "查詢錯誤:" & Err.Description
iflag = 2
Resume transactsql_exit
End Sub
Public Sub tabtoenter(key As Integer)
If key = 13 Then '判斷是否為回車鍵
SendKeys "{Tab}"
End If
End Sub
Sub main()
frmlogin.Show
End Sub
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -