📄 qry_in.frm
字号:
AutoSize = -1 'True
Caption = "自"
ForeColor = &H000000C0&
Height = 300
Left = 240
TabIndex = 10
Top = 480
Width = 240
End
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "查询结果"
Height = 300
Left = 360
TabIndex = 26
Top = 3360
Width = 960
End
End
Attribute VB_Name = "qry_in"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim Datetime As String
Dim Proclass As String
Dim Propos As String
Dim Proname As String
Dim Promanager As String
Dim Partaname As String
Dim Partacharge As String
Dim Contractnum As String
Dim Contractdoc As String
Dim Scheme As String
Dim Remarks As String
Dim StartDate As String
Dim EndDate As String
Dim ItemClass As String
Dim ItemName As String
Dim ItemSpec As String
Dim QtyIn As Long
Dim UnitIn As String
Dim person As String
Private Sub Command1_Click()
Dim Guige(100) As String
Dim SuLiang As String
Dim DisStr As String
Dim ItemNm As String
Dim i As Integer
Dim K As Integer
Static RowNum As Integer
Static SpecNum As Integer
StartDate = Text1.Text + "-" + Text2.Text + "-" + Text3.Text
EndDate = Text4.Text + "-" + Text5.Text + "-" + Text6.Text
If Len(StartDate) < 10 Then
rc = MsgBox("请输入查询起始时间!", vbOKOnly + vbExclamation, "输入查询条件不全")
Text1.SetFocus
Exit Sub
End If
If Len(EndDate) < 10 Then
rc = MsgBox("请输入查询截止时间!", vbOKOnly + vbExclamation, "输入查询条件不全")
Text4.SetFocus
Exit Sub
End If
If List3.ListCount = 0 Then
rc = MsgBox("请选择要查询的项目类型!", vbOKOnly + vbExclamation, "查询条件不全")
Exit Sub
End If
RowNum = 0
With MSFlexGrid1
.Clear
.Rows = 1
.Visible = True
.FormatString = "^ 项目名称 "
.Row = RowNum
End With
For i = 0 To List3.ListCount - 1
ItemNm = SpaceCut(List3.List(i))
rc = SQLAllocStmt(hdbc, hstmt)
SQLstmt = "SELECT proname FROM prorecord WHERE proclass Like'" & ItemNm & "%'"
rc = SQLExecDirect(hstmt, SQLstmt, SQL_NTS)
If rc = SQL_ERROR Then
rc = SQLFreeStmt(hstmt, SQL_DROP)
MsgBox "1"
Exit Sub
End If
SpecNum = 0
Do While SQLFetch(hstmt) <> SQL_NO_DATA_FOUND
SpecNum = SpecNum + 1
Guige(SpecNum) = String$(50, 0)
rc = SQLGetData(hstmt, 1, SQL_C_CHAR, Guige(SpecNum), Len(Guige(SpecNum)), SQL_NULL_DATA)
Guige(SpecNum) = SpaceCut(Guige(SpecNum))
Loop
rc = SQLFreeStmt(hstmt, SQL_DROP)
If SpecNum = 0 Then
rc = MsgBox("未查到" + ItemNm, vbOKOnly + vbExclamation, "查询无结果")
GoTo GoingOn
End If
MSFlexGrid1.Rows = MSFlexGrid1.Rows + SpecNum
MSFlexGrid1.Row = RowNum
For K = 1 To SpecNum
RowNum = RowNum + 1
With MSFlexGrid1
.Row = RowNum
'.Col = 0
.Text = Guige(K)
End With
Next K
GoingOn:
Next i
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Command5_Click()
Dim i As Integer
If List1.Text <> "" Then
List3.AddItem List1.Text
List1.RemoveItem List1.ListIndex
End If
End Sub
Private Sub Command6_Click()
Dim i As Integer
If List3.ListCount = 0 Then
For i = 0 To List1.ListCount - 1
List3.AddItem List1.List(i), i
Next
List1.Clear
End If
End Sub
Private Sub Command7_Click()
Dim i As Integer
If List3.Text <> "" Then
List1.AddItem List3.Text
List3.RemoveItem List3.ListIndex
End If
End Sub
Private Sub Command8_Click()
Dim i As Integer
If List1.ListCount = 0 Then
For i = 0 To List3.ListCount - 1
List1.AddItem List3.List(i), i
Next
List3.Clear
End If
End Sub
Private Sub Form_Load()
Dim i As Integer
MSFlexGrid1.Visible = False
MSFlexGrid1.Rows = 1
MSFlexGrid1.Cols = 1
Text1.Text = Year(Date) - 2
Text2.Text = Month(Date)
If Len(Text2.Text) < 2 Then Text2.Text = "0" + Text2.Text
Text3.Text = Day(Date)
If Len(Text3.Text) < 2 Then Text3.Text = "0" + Text3.Text
Text4.Text = Year(Date)
Text5.Text = Month(Date)
If Len(Text5.Text) < 2 Then Text5.Text = "0" + Text5.Text
Text6.Text = Day(Date)
If Len(Text6.Text) < 2 Then Text6.Text = "0" + Text6.Text
End Sub
Private Sub Form_Unload(Cancel As Integer)
List3.Clear
MSFlexGrid1.Clear
Form1.Enabled = True
End Sub
Private Sub List1_DblClick()
Command5.Value = True
End Sub
Private Sub List3_DblClick()
Command7.Value = True
End Sub
Private Sub MSFlexGrid1_DblClick()
Proname = SpaceCut(MSFlexGrid1.Text)
Datetime = String(11, " ")
Proclass = String(10, " ")
Propos = String(50, " ")
Promanager = String(50, " ")
Partaname = String(50, " ")
Partacharge = String(50, " ")
Contractnum = String(50, " ")
Contractdoc = String(50, " ")
Scheme = String(50, " ")
Remarks = String(200, " ")
rc = SQLAllocStmt(hdbc, hstmt)
SQLstmt = "SELECT datetime,proclass,propos,promanager,partaname,partacharge,contractnum,contractdoc,scheme,remarks FROM prorecord WHERE proname Like'" & Proname & "%'"
rc = SQLExecDirect(hstmt, SQLstmt, SQL_NTS)
rc = SQLFetch(hstmt)
rc = SQLGetData(hstmt, 1, SQL_C_CHAR, Datetime, Len(Datetime), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 2, SQL_C_CHAR, Proclass, Len(Proclass), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 3, SQL_C_CHAR, Propos, Len(Propos), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 4, SQL_C_CHAR, Promanager, Len(Promanager), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 5, SQL_C_CHAR, Partaname, Len(Partaname), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 6, SQL_C_CHAR, Partacharge, Len(Partacharge), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 7, SQL_C_CHAR, Contractnum, Len(Contractnum), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 8, SQL_C_CHAR, Contractdoc, Len(Contractdoc), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 9, SQL_C_CHAR, Scheme, Len(Scheme), SQL_NULL_DATA)
rc = SQLGetData(hstmt, 10, SQL_C_CHAR, Remarks, Len(Remarks), SQL_NULL_DATA)
rc = SQLFreeStmt(hstmt, SQL_DROP)
Datetime = Trim(Datetime)
in_query.Text12.Text = Proclass
in_query.Text1.Text = MidB(Datetime, 1, 8)
in_query.Text2.Text = MidB(Datetime, 11, 4)
in_query.Text3.Text = MidB(Datetime, 17, 4)
in_query.Text6.Text = Propos
in_query.Text13.Text = Promanager
in_query.Text7.Text = Partaname
in_query.Text8.Text = Partacharge
in_query.Text9.Text = Contractnum
in_query.Text10.Text = Contractdoc
in_query.Text11.Text = Scheme
in_query.Text5.Text = Remarks
in_query.Text4.Text = Proname
in_query.Visible = True
qry_in.Enabled = False
End Sub
Private Sub Text2_LostFocus()
If Len(Text2.Text) < 2 Then Text2.Text = "0" + Text2.Text
End Sub
Private Sub Text3_LostFocus()
If Len(Text3.Text) < 2 Then Text3.Text = "0" + Text3.Text
End Sub
Private Sub Text5_LostFocus()
If Len(Text5.Text) < 2 Then Text5.Text = "0" + Text5.Text
End Sub
Private Sub Text6_LostFocus()
If Len(Text6.Text) < 2 Then Text6.Text = "0" + Text6.Text
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -