📄 frmbasiccurrencysubinfo.frm
字号:
VERSION 5.00
Object = "{4932CEF1-2CAA-11D2-A165-0060081C43D9}#2.0#0"; "Actbar2.OCX"
Begin VB.Form frmBasicCurrencySubInfo
Caption = "幣種信息明細"
ClientHeight = 4995
ClientLeft = 60
ClientTop = 345
ClientWidth = 3990
LinkTopic = "Form1"
ScaleHeight = 4995
ScaleWidth = 3990
StartUpPosition = 3 'Windows Default
Begin ActiveBar2LibraryCtl.ActiveBar2 ActiveBar21
Height = 4995
Left = 0
TabIndex = 0
Top = 0
Width = 3990
_LayoutVersion = 1
_ExtentX = 7038
_ExtentY = 8811
_DataPath = ""
Bands = "frmBasicCurrencySubInfo.frx":0000
Begin VB.Frame Frame1
Height = 4395
Left = 60
TabIndex = 1
Top = 540
Width = 3795
Begin VB.TextBox txtUpdateOperator
Height = 315
Left = 1500
MaxLength = 20
TabIndex = 10
Top = 2760
Width = 1995
End
Begin VB.TextBox txtCurrencySymbol
Height = 315
Left = 1500
MaxLength = 20
TabIndex = 9
Top = 2220
Width = 1995
End
Begin VB.TextBox txtUpdateDate
BackColor = &H8000000F&
Enabled = 0 'False
Height = 315
Left = 1500
TabIndex = 8
Top = 3300
Width = 1995
End
Begin VB.TextBox txtRate
BackColor = &H00C0FFC0&
Height = 315
Left = 1500
TabIndex = 7
Text = "0"
Top = 1680
Width = 1995
End
Begin VB.TextBox txtCurrencyCapital
BackColor = &H00FFFFFF&
Height = 315
Left = 1500
MaxLength = 100
TabIndex = 6
Top = 720
Width = 1995
End
Begin VB.TextBox txtCurrencyAllName
BackColor = &H00FFFFFF&
Height = 315
Left = 1500
MaxLength = 50
TabIndex = 5
Top = 1200
Width = 1995
End
Begin VB.CommandButton cmdOk
Caption = "確定 &A"
Height = 315
Left = 540
TabIndex = 4
Top = 3900
Width = 735
End
Begin VB.CommandButton cmdClose
Caption = "關閉 &C"
Height = 315
Left = 2160
TabIndex = 3
Top = 3900
Width = 735
End
Begin VB.TextBox txtCurrencyName
BackColor = &H00C0C0FF&
Height = 315
Left = 1500
MaxLength = 20
TabIndex = 2
Top = 240
Width = 1995
End
Begin VB.Label Label6
Caption = "填寫人"
Height = 315
Left = 180
TabIndex = 17
Top = 2760
Width = 915
End
Begin VB.Label Label5
Caption = "幣種篻號"
Height = 315
Left = 180
TabIndex = 16
Top = 2220
Width = 795
End
Begin VB.Label Label4
Caption = "填写日期"
Height = 315
Left = 180
TabIndex = 15
Top = 3300
Width = 915
End
Begin VB.Label Label2
Caption = "對應匯率"
Height = 315
Left = 180
TabIndex = 14
Top = 1680
Width = 915
End
Begin VB.Label Label1
Caption = "幣種大寫"
Height = 255
Left = 180
TabIndex = 13
Top = 720
Width = 855
End
Begin VB.Label Label7
Caption = "中文名稱"
Height = 255
Left = 180
TabIndex = 12
Top = 1200
Width = 1035
End
Begin VB.Label Label3
Caption = "幣種簡稱"
Height = 255
Index = 4
Left = 180
TabIndex = 11
Top = 300
Width = 1035
End
End
End
End
Attribute VB_Name = "frmBasicCurrencySubInfo"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Public newItem As Boolean 'true表示增加
Private Sub ActiveBar21_ToolClick(ByVal Tool As ActiveBar2LibraryCtl.Tool)
Select Case Tool.Name
Case "cmdSave":
Save newItem
Case "cmdCancel":
Unload Me
Case "cmdDel":
DelOperatorInf
End Select
End Sub
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdOk_Click()
Save newItem
End Sub
Private Sub Form_Load()
Me.Move (Screen.Width - Me.Width) \ 2, (Screen.Height - Me.Height) \ 2
InitTitle
End Sub
Private Sub InitTitle()
Label1.Caption = "幣種大寫"
Label2.Caption = "對應匯率"
Label3.item(4).Caption = "幣種簡稱"
Label4.Caption = "填寫日期"
Label5.Caption = "幣種篻號"
Label6.Caption = "填寫人"
Label7.Caption = "中文名稱"
Me.Caption = "幣種信息明細"
cmdOk.Caption = "確定 &O"
cmdClose.Caption = "關閉 &C"
End Sub
Private Sub DelOperatorInf()
Dim strSql As String
On Error GoTo errHandle
If MsgBox("确定要刪除?", vbQuestion + vbYesNo, "询问") = vbNo Then
Exit Sub
Else
strSql = "delete from tBasicCurrency where CurrencyName='" & txtCurrencyName & "'"
objDatabase.ExecCmd strSql
MsgBox "刪除成功!", vbInformation, "提示"
End If
FrmBasicCurrencyInfo.FillMshf1 ("select * from tBasicCurrency")
Unload Me
Exit Sub
errHandle:
objDatabase.DatabaseError
End Sub
Public Sub InitInfo(strId As String)
If newItem = False Then
Dim rs As ADODB.Recordset
' On Error GoTo errLabel
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
Dim strSql As String
strSql = "select * from tBasicCurrency where CurrencyName='" & strId & "'"
rs.Open strSql
If Not rs.EOF Then
txtCurrencyName = NullValue(rs.Fields!CurrencyName)
txtCurrencyCapital = NullValue(rs.Fields!Currencycapital)
txtCurrencyAllName = NullValue(rs.Fields!currencyallname)
txtRate = NullValue(rs.Fields!Rate)
txtCurrencySymbol = NullValue(rs.Fields!CurrencySymbol)
txtUpdateOperator = NullValue(rs.Fields!UpdateOperator)
txtUpdateDate = NullValue(rs.Fields!UpdateDate)
End If
rs.Close
Set rs = Nothing
SystemExecuteEnd Me
End If
Exit Sub
errLabel:
SystemExecuteEnd Me
objDatabase.DatabaseError
End Sub
Private Sub Save(Optional blModi As Boolean)
Dim strSql As String
Dim rs As ADODB.Recordset
On Error GoTo errHandle
Set rs = New ADODB.Recordset
With rs
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.LockType = adLockOptimistic
Set .ActiveConnection = Cn
End With
If txtCurrencyName = "" Then
MsgBox "幣種名稱不能為空!", vbCritical, "提示"
txtCurrencyName.SetFocus
Exit Sub
End If
If IsNumeric(txtRate) = False Then
MsgBox "請在匯率上填寫正確格式", vbInformation + vbOKOnly, "提示"
Exit Sub
End If
If blModi Then
strSql = "select * from tBasicCurrency where CurrencyName='" & txtCurrencyName & "'"
rs.Open strSql
If Not rs.EOF Then
MsgBox "此幣種已存在!", vbCritical, "提示"
txtCurrencyName.Text = ""
txtCurrencyName.SetFocus
rs.Close
Set rs = Nothing
Exit Sub
End If
If MsgBox("是否添加新的幣種?", vbQuestion + vbYesNo, "询问") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.AddNew '新建
rs.Fields!CurrencyName = txtCurrencyName
rs.Fields!Currencycapital = txtCurrencyCapital
rs.Fields!currencyallname = txtCurrencyAllName
rs.Fields!Rate = txtRate
rs.Fields!CurrencySymbol = txtCurrencySymbol
rs.Fields!UpdateOperator = Trim$(txtUpdateOperator)
rs.Fields!UpdateDate = Now
rs.Update
MsgBox "新建成功!", vbInformation, "恭喜'"
Else
strSql = "select * from tBasicCurrency where CurrencyName='" & txtCurrencyName & "'"
rs.Open strSql
If rs.EOF Then '修改
MsgBox "没有可修改的记录!", vbExclamation, "修改"
rs.Close
Set rs = Nothing
txtCurrencyName.SetFocus
Exit Sub
End If
If MsgBox("是否修改记录?", vbYesNo + vbQuestion, "修改") = vbNo Then
rs.Close
Set rs = Nothing
Exit Sub
End If
rs.Fields!CurrencyName = txtCurrencyName
rs.Fields!Currencycapital = txtCurrencyCapital
rs.Fields!currencyallname = txtCurrencyAllName
rs.Fields!Rate = txtRate
rs.Fields!CurrencySymbol = txtCurrencySymbol
rs.Fields!UpdateOperator = Trim$(txtUpdateOperator)
rs.Fields!UpdateDate = Now
rs.Update
MsgBox "修改成功!", vbInformation, "恭喜"
End If
rs.Close
Set rs = Nothing
FrmBasicCurrencyInfo.FillMshf1 ("select * from tBasicCurrency")
Unload Me
Exit Sub
errHandle:
Set rs = Nothing
objDatabase.DatabaseError
End Sub
Private Sub txtRate_KeyPress(KeyAscii As Integer)
If KeyAscii <> 8 And KeyAscii <> 13 And KeyAscii <> 46 Then
If KeyAscii < 48 Or KeyAscii > 57 Then KeyAscii = 0
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -