📄 dbsms.frm
字号:
VERSION 5.00
Object = "{997F88E9-8CA8-4FD7-A3C6-F411CF22CD7C}#43.0#0"; "MFBUS15.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form frmSMSdb
BorderStyle = 1 'Fixed Single
Caption = "SMS in DataBase"
ClientHeight = 6870
ClientLeft = 45
ClientTop = 330
ClientWidth = 6090
LinkTopic = "Form1"
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 6870
ScaleWidth = 6090
StartUpPosition = 3 'Windows Default
Begin VB.CommandButton cmdDelInbox
Caption = "Hapus SMS inbox"
Height = 495
Left = 4920
TabIndex = 8
Top = 600
Width = 1095
End
Begin MSDataGridLib.DataGrid grid
Height = 3375
Left = 120
TabIndex = 7
Top = 600
Width = 4695
_ExtentX = 8281
_ExtentY = 5953
_Version = 393216
AllowUpdate = -1 'True
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "MS Sans Serif"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ColumnCount = 2
BeginProperty Column00
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 1033
SubFormatType = 0
EndProperty
EndProperty
BeginProperty Column01
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 1033
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.CommandButton cmdDeleteDB
Caption = "Delete Record"
Height = 495
Left = 4920
TabIndex = 6
Top = 1080
Width = 1095
End
Begin VB.CommandButton cmdReport
Caption = "Report"
Height = 495
Left = 3240
TabIndex = 4
Top = 4320
Width = 1575
End
Begin VB.Frame Frame1
Height = 2775
Left = 120
TabIndex = 3
Top = 4080
Width = 4815
Begin VB.CommandButton cmdBln
Caption = "Tampil"
Height = 495
Left = 3840
TabIndex = 11
Top = 840
Width = 735
End
Begin VB.TextBox txtbulan
Height = 495
Left = 3120
TabIndex = 9
Top = 840
Width = 615
End
Begin MSComCtl2.MonthView cal
Height = 2370
Left = 240
TabIndex = 5
Top = 240
Width = 2700
_ExtentX = 4763
_ExtentY = 4180
_Version = 393216
ForeColor = -2147483630
BackColor = -2147483633
Appearance = 1
StartOfWeek = 24444929
CurrentDate = 37800
End
Begin VB.Label Label1
Caption = "mm/yy"
Height = 255
Left = 3240
TabIndex = 10
Top = 1320
Width = 495
End
End
Begin VB.CommandButton cmdambil
Caption = "Update Database"
Height = 375
Left = 1560
TabIndex = 2
Top = 120
Width = 2055
End
Begin VB.ComboBox cmbBox
Height = 315
Left = 120
TabIndex = 1
Top = 120
Width = 1335
End
Begin MFBUS15.MFBUS15Control bus
Height = 480
Left = 5160
TabIndex = 0
Top = 0
Width = 480
_ExtentX = 847
_ExtentY = 847
End
End
Attribute VB_Name = "frmSMSdb"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private m_SmsBox As FBSmsBox
Dim db As Connection
Dim ambilrs As Recordset
Private Sub cmbBox_click()
On Error GoTo pesan
bus.Connect cmbBox.Text
If bus.Connected = True Then
MsgBox "Connected"
End If
Screen.MousePointer = vbHourglass
bus.SMS.Refresh
Set db = New Connection
db.CursorLocation = adUseClient
db.Open "PROVIDER=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\sms.mdb;"
Set ambilrs = New Recordset
ambilrs.Open "select nomor,tanggal,jam,isi from terima", db, adOpenStatic, adLockOptimistic
Set grid.DataSource = ambilrs
grid.Columns(3).Width = "6000"
Screen.MousePointer = vbDefault
pesan:
If Err <> 0 Then
MsgBox "Gagal di connect"
End If
End Sub
Private Sub cmdambil_Click()
Dim i As Integer, sMsg As String
With bus
Set m_SmsBox = .SMS.Inbox
For i = 1 To m_SmsBox.Count
With m_SmsBox(i)
If .Sender <> "" Then
sMsg = .Sender
ambilrs.AddNew
ambilrs("tanggal") = Left(m_SmsBox(i).DateTime, 8)
ambilrs("jam") = Mid(m_SmsBox(i).DateTime, 8, 12)
ambilrs("nomor") = sMsg
ambilrs("isi") = m_SmsBox(i).Text
ambilrs("bulan") = Left(m_SmsBox(i).DateTime, 2) & "/" & Right(Left(m_SmsBox(i).DateTime, 8), 2)
ambilrs.Update
m_SmsBox(i).Delete
End If
End With
Next i
End With
Set m_SmsBox = Nothing
Set grid.DataSource = ambilrs
End Sub
Private Sub cmdBln_Click()
Dim costRS As Recordset
Set costRS = New Recordset
costRS.Open "select nomor,tanggal,jam,isi from terima where bulan='" & txtbulan.Text & "'", db, adOpenStatic, adLockOptimistic
Set DataReport1.DataSource = costRS
DataReport1.Show
'costRS.Close
Set costRS = Nothing
End Sub
Private Sub cmdDeleteDB_Click()
ambilrs.Delete
End Sub
Private Sub cmdDelInbox_Click()
Dim i As Integer, sMsg As String
With bus
Set m_SmsBox = .SMS.Inbox
For i = 1 To m_SmsBox.Count
With m_SmsBox(i)
If .Sender <> "" Then
m_SmsBox(i).Delete
End If
End With
Next i
End With
Set m_SmsBio = Nothing
End Sub
Private Sub cmdReport_Click()
Dim reportRS As Recordset
Set reportRS = New Recordset
reportRS.Open "select * from terima where tanggal='" & cal.Value & "'", db, adOpenStatic, adLockOptimistic
Set DataReport1.DataSource = reportRS
DataReport1.Show
Set reportRS = Nothing
End Sub
Private Sub Command1_Click()
End Sub
Private Sub Form_Load()
grid.Columns(1).Width = "8000"
With cmbBox
.AddItem "COM1"
.AddItem "COM2"
.AddItem "COM3"
End With
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -