- ©«¤l
- 2035
- ¥DÃD
- 24
- ºëµØ
- 0
- ¿n¤À
- 2031
- ÂI¦W
- 0
- §@·~¨t²Î
- Win7
- ³nÅ骩¥»
- Office2010
- ¾\ŪÅv
- 100
- ©Ê§O
- ¨k
- µù¥U®É¶¡
- 2012-3-22
- ³Ì«áµn¿ý
- 2024-2-1
|
¦^´_ 5# c_c_lai - Private Sub DeleteData_Click()
- Dim nCode As Range, ret As Boolean
-
- With Sheets("data")
- Set nCode = .[B:B].Find(CallID.Text, , , 1)
- .Rows(Val(Mid(nCode.Address, 4))).EntireRow.Delete Shift:=xlUp
- End With
-
- ret = ExcelData.Value
- ExcelData.Value = False
-
- closeRS
- OpenDB
-
- strSQL = "DELETE FROM ¾÷²¼¬ö¿ý WHERE ¦W¦r = '" & CallID.Text & "'"
- cmd.CommandText = strSQL
-
- cmd.ActiveConnection = cnn
- cmd.Execute
- cnn.Close
-
- Confirm.Enabled = True
- ExcelData.Value = ret
- ResetData_Click
- End Sub
- Sub ResetData_Click()
- CallID.Text = ""
- RecordExisted.Caption = ""
- Confirm.Enabled = True
- DataCear
- End Sub
- Private Sub DataCear()
- DeptNo.Text = ""
- DateTime.Text = ""
- CreditDate.Text = ""
- License1.Text = ""
- LicenseFee1.Text = "0"
- License2.Text = ""
- LicenseFee2.Text = "0"
- cabin.Text = ""
- ticketfee.Text = "0"
- totalfee.Text = "0"
- routinefrom.Text = ""
- routineto.Text = ""
- contents.Text = ""
- remarks.Text = ""
- End Sub
- Private Sub SaveData_Click()
- Dim totalRows As Long, ret As Boolean
- Dim nCode As Range
-
- ret = ExcelData.Value
- ExcelData.Value = True
-
- With Sheets("data")
- ' ¼g¤J Sheets("data")
- If editMode = True Then
- Set nCode = Sheets("data").[B:B].Find(CallID.Text, , , 1)
-
- With nCode
- .Offset(, -1) = DeptNo.Text
- .Offset(, 2) = CreditDate.Text
- .Offset(, 3) = routinefrom.Text
- .Offset(, 4) = routineto.Text
- .Offset(, 5) = contents.Text
- .Offset(, 6) = cabin.Text
- .Offset(, 7) = License1.Text
- .Offset(, 8) = LicenseFee1.Text
- .Offset(, 9) = License2.Text
- .Offset(, 10) = LicenseFee2.Text
- .Offset(, 11) = ticketfee.Text
- .Offset(, 12) = totalfee.Text
- .Offset(, 13) = remarks.Text
- End With
- Else
- With Sheets("data")
- strSQL = "SELECT * FROM [data$] WHERE [¦W¦r] ='" & CallID.Text & "'"
-
- ' Now extract data
- closeRS
- OpenDB
-
- rs.Open strSQL, cnn, 1, 3 ' adOpenKeyset, adLockOptimistic
-
- If rs.RecordCount = 0 Then ' ¥ý§PÂ_¸ê®Æ¬O§_¤w¸g¦s¦b¡A¦pªG¤£¦s¦b¡A«h ...
- Set nCode = .Range("B" & .Range("B" & Rows.Count).End(xlUp).Row + 1)
-
- With nCode
- .Offset(, 0) = CallID.Text
- .Offset(, -1) = DeptNo.Text
- .Offset(, 1).NumberFormat = "m/d/yyyy hh:mm:ss"
- .Offset(, 1) = Format(DateTime.Text, "m/d/yyyy hh:mm:ss")
- .Offset(, 2) = CreditDate.Text
- .Offset(, 3) = routinefrom.Text
- .Offset(, 4) = routineto.Text
- .Offset(, 5) = contents.Text
- .Offset(, 6) = cabin.Text
- .Offset(, 7) = License1.Text
- .Offset(, 8) = LicenseFee1.Text
- .Offset(, 9) = License2.Text
- .Offset(, 10) = LicenseFee2.Text
- .Offset(, 11) = ticketfee.Text
- .Offset(, 12) = totalfee.Text
- .Offset(, 13) = remarks.Text
- End With
- End If
- End With
- End If
-
- ExcelData.Value = False
- ' Now extract data
- closeRS
- OpenDB
-
- ' ¼g¤J Access ¸ê®Æ®w
- If editMode = True Then
- strSQL = "Update ¾÷²¼¬ö¿ý SET ¦W¦r = '" & CallID.Text & "', ³æ¦ì = '" & DeptNo.Text & _
- "', ¨ê¥d¤é´Á = '" & CreditDate.Text & "', ¦æµ{¤é´Á±q = '" & routinefrom.Text & _
- "', ¦æµ{¤é´Á¨ì = '" & routineto.Text & "', ¦æµ{¤º®e = '" & contents.Text & _
- "', ¿µµ¥ = '" & cabin.Text & "', ñÃÒ¤º®e1 = '" & License1.Text & "', ñÃÒ¶O¥Î1 = " & _
- LicenseFee1.Text & ", ñÃÒ¤º®e2 = '" & License2.Text & "', ñÃÒ¶O¥Î2 = " & LicenseFee2.Text & _
- ", ¾÷²¼¶O¥Î = " & ticketfee.Text & ", Á`p = " & totalfee.Text & ", ³Æµù = '" & _
- remarks.Text & "' WHERE ¦W¦r = '" & CallID.Text & "';"
- Else
- strSQL = "INSERT INTO ¾÷²¼¬ö¿ý (³æ¦ì,¦W¦r,¤é´Á,¨ê¥d¤é´Á,¦æµ{¤é´Á±q,¦æµ{¤é´Á¨ì,¦æµ{¤º®e," & _
- "¿µµ¥,ñÃÒ¤º®e1,ñÃÒ¶O¥Î1,ñÃÒ¤º®e2,ñÃÒ¶O¥Î2,¾÷²¼¶O¥Î,Á`p,³Æµù) VALUES ('" & DeptNo.Text & "','" & _
- CallID.Text & "','" & DateTime.Text & "','" & CreditDate.Text & "','" & routinefrom.Text & "','" & _
- routineto.Text & "','" & contents.Text & "','" & cabin.Text & "','" & License1.Text & "'," _
- & LicenseFee1.Text & ",'" & License2.Text & "'," & LicenseFee2.Text & "," & ticketfee.Text & "," & _
- totalfee.Text & ",'" & remarks.Text & "') ;"
- End If
- ' Sheets("data").[A20] = strSQL ' Àˬd strSQL »yªk¤º®e¬O§_¥¿½T
- cmd.CommandText = strSQL
-
- cmd.ActiveConnection = cnn
- cmd.Execute
- cnn.Close
-
- Confirm.Enabled = True
- SaveData.Enabled = False
- ResetData.Enabled = False
- ExcelData.Value = ret
- ResetData_Click
- End With
- End Sub
½Æ»s¥N½X |
|