📄 form7.frm
字号:
DataField = ""
Caption = ""
BeginProperty DataFormat {6D835690-900B-11D0-9484-00A0C91110ED}
Type = 0
Format = ""
HaveTrueFalseNull= 0
FirstDayOfWeek = 0
FirstWeekOfYear = 0
LCID = 2052
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 = 2052
SubFormatType = 0
EndProperty
EndProperty
SplitCount = 1
BeginProperty Split0
BeginProperty Column00
EndProperty
BeginProperty Column01
EndProperty
EndProperty
End
Begin VB.Label Label5
Caption = "企业税号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 315
Left = 1080
TabIndex = 12
Top = 3630
Width = 1230
End
Begin VB.Label Label4
Caption = "注销标记:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 300
Left = 1065
TabIndex = 11
Top = 4095
Width = 1215
End
Begin VB.Label Label3
Caption = "注销标记:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 375
Left = -74430
TabIndex = 6
Top = 2520
Width = 1275
End
Begin VB.Label Label2
Caption = "企业税号:"
BeginProperty Font
Name = "宋体"
Size = 12
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 390
Left = -74430
TabIndex = 5
Top = 1920
Width = 1275
End
Begin VB.Line Line2
BorderColor = &H80000005&
X1 = -74970
X2 = -68130
Y1 = 1335
Y2 = 1335
End
Begin VB.Line Line1
X1 = -75000
X2 = -68160
Y1 = 1320
Y2 = 1320
End
Begin VB.Label Label1
Caption = "请输入企业税号:"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 330
Left = -74760
TabIndex = 2
Top = 675
Width = 1695
End
End
End
Attribute VB_Name = "Form7"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private bc As Integer
Private Sub Command1_Click()
If Text1.Text = "" Then
MsgBox ("企业税号不能为空!!")
Exit Sub
End If
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.Find "sh='" & UCase(Trim(Text1.Text)) & "'"
If Adodc1.Recordset.EOF Then
MsgBox ("此企业税号没找到!!")
Text2.Text = ""
Text3.Text = ""
Exit Sub
Else
Text2.Text = Adodc1.Recordset!sh
Text3.Text = Adodc1.Recordset!bj
End If
End Sub
Private Sub Command2_Click()
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=qfgl"
cn.Open
Dim cm As ADODB.Command
Set cm = New ADODB.Command
cm.ActiveConnection = cn
cm.CommandType = adCmdText
cm.CommandText = "delete from sheet1 where sh='" & Trim(Text1.Text) & "'"
cm.Execute
cn.Close
Text2.Text = ""
Text3.Text = ""
Text4.Text = ""
Text5.Text = ""
Adodc1.Recordset.Requery
DataGrid1.Refresh
End Sub
Private Sub Command3_Click()
bc = 1
Command3.Enabled = False
Command5.Enabled = True
Command6.Enabled = True
Command8.Enabled = False
Text4.Text = ""
Text5.Text = ""
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
Command3.Enabled = True
Command5.Enabled = False
Command6.Enabled = False
Command8.Enabled = True
End Sub
Private Sub Command6_Click()
If Text4.Text = "" Or Text5.Text = "" Then
MsgBox ("项目没有录全,不能保存!!")
Exit Sub
End If
If Len(Trim(Text4.Text)) <> 15 Then
MsgBox ("企业税号为15位!!")
Exit Sub
End If
If CInt(Trim(Text5.Text)) <> 0 And CInt(Trim(Text5.Text)) <> 1 Then
MsgBox ("注销标记只能为“0“或”1”!!")
Command3.Enabled = True
Command8.Enabled = True
Command5.Enabled = False
Command6.Enabled = False
Exit Sub
End If
Adodc1.Recordset.MoveFirst
If bc = 1 Then
Adodc1.Recordset.Find "sh='" & Trim(Text4.Text) & "'"
If Not Adodc1.Recordset.EOF Then
MsgBox ("企业税号已经存在!!!")
Text4.Text = ""
Text5.Text = ""
Exit Sub
End If
Adodc1.Recordset.AddNew
Adodc1.Recordset!sh = Text4.Text
Adodc1.Recordset!bj = Text5.Text
Adodc1.Recordset.Update
End If
Command3.Enabled = True
Command5.Enabled = False
Command6.Enabled = False
Command8.Enabled = True
End Sub
Private Sub Command8_Click()
Unload Me
End Sub
Private Sub Form_Load()
Adodc1.Refresh
If Adodc1.Recordset.EOF Then
Dim cn As ADODB.Connection
Set cn = New ADODB.Connection
cn.ConnectionString = "Provider=MSDASQL.1;Persist Security Info=False;User ID=sa;Data Source=qfgl"
cn.Open
Dim cm As ADODB.Command
Set cm = New ADODB.Command
cm.ActiveConnection = cn
cm.CommandType = adCmdText
cm.CommandText = "insert into sheet1(sh,bj) values('111111111111111','1')"
cm.Execute
cn.Close
Adodc1.Recordset.Requery
End If
Dim rsdak As ADODB.Recordset
Set rsdak = New ADODB.Recordset
rsdak.CursorLocation = adUseClient
rsdak.Fields.Append "bh", adChar, 6
rsdak.Fields.Append "sh", adChar, 15
rsdak.Fields.Append "bj", adChar, 1
rsdak.Open
Adodc1.Recordset.MoveFirst
Adodc1.Recordset.MoveLast
Dim zh As Long
zh = Adodc1.Recordset.RecordCount
Adodc1.Recordset.MoveFirst
Dim x As Long
For x = 1 To zh
rsdak.AddNew
rsdak!bh = CStr(x)
rsdak!sh = Adodc1.Recordset!sh
rsdak!bj = Adodc1.Recordset!bj
rsdak.Update
Adodc1.Recordset.MoveNext
Next
Set DataGrid1.DataSource = rsdak
DataGrid1.Columns(0).Caption = " 编号"
DataGrid1.Columns(1).Caption = " 税号"
DataGrid1.Columns(2).Caption = " 标记"
DataGrid1.Columns(0).Width = 500
DataGrid1.Columns(1).Width = 3000
DataGrid1.Columns(2).Width = 500
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -