📄 frmsearchid.frm
字号:
VERSION 5.00
Object = "{67397AA1-7FB1-11D0-B148-00A0C922E820}#6.0#0"; "MSADODC.OCX"
Object = "{CDE57A40-8B86-11D0-B3C6-00A0C90AEA82}#1.0#0"; "MSDATGRD.OCX"
Begin VB.Form frmSearchId
Caption = "按编号查询"
ClientHeight = 7065
ClientLeft = 60
ClientTop = 345
ClientWidth = 9120
LinkTopic = "Form1"
ScaleHeight = 7065
ScaleWidth = 9120
StartUpPosition = 2 '屏幕中心
WindowState = 2 'Maximized
Begin VB.Frame Frame2
Caption = "查询结果"
Height = 5295
Left = 240
TabIndex = 3
Top = 1560
Width = 8535
Begin MSAdodcLib.Adodc adoSearchId
Height = 375
Left = 2760
Top = 2160
Visible = 0 'False
Width = 2535
_ExtentX = 4471
_ExtentY = 661
ConnectMode = 0
CursorLocation = 3
IsolationLevel = -1
ConnectionTimeout= 15
CommandTimeout = 30
CursorType = 3
LockType = 3
CommandType = 8
CursorOptions = 0
CacheSize = 50
MaxRecords = 0
BOFAction = 0
EOFAction = 0
ConnectStringType= 1
Appearance = 1
BackColor = -2147483643
ForeColor = -2147483640
Orientation = 0
Enabled = -1
Connect = ""
OLEDBString = ""
OLEDBFile = ""
DataSourceName = ""
OtherAttributes = ""
UserName = ""
Password = ""
RecordSource = ""
Caption = "adosearchid"
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_Version = 393216
End
Begin MSDataGridLib.DataGrid DataGrid1
Bindings = "frmSearchId.frx":0000
Height = 4935
Left = 120
TabIndex = 5
Top = 240
Width = 8295
_ExtentX = 14631
_ExtentY = 8705
_Version = 393216
HeadLines = 1
RowHeight = 15
BeginProperty HeadFont {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
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 = 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
End
Begin VB.Frame Frame1
Caption = "查询条件"
Height = 1095
Left = 240
TabIndex = 0
Top = 240
Width = 8535
Begin VB.ComboBox Combo1
Height = 300
Left = 1560
TabIndex = 6
Top = 360
Width = 1935
End
Begin VB.CommandButton cmdClose
Caption = "返回"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 6720
TabIndex = 4
Top = 360
Width = 1335
End
Begin VB.CommandButton cmdSearch
Caption = "查询"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 495
Left = 4800
TabIndex = 2
Top = 360
Width = 1575
End
Begin VB.Label Label1
Caption = "销售编号:"
Height = 255
Left = 600
TabIndex = 1
Top = 480
Width = 975
End
End
End
Attribute VB_Name = "frmSearchId"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Sub cmdClose_Click()
Unload Me
End Sub
Private Sub cmdSearch_Click()
Dim strSearchId As String
Dim sql As String
strSearchId = Trim(Me.Combo1.Text)
If strSearchId = "" Then
MsgBox "销售编号不能为空,请重试!", vbExclamation + vbOKOnly, "系统提示"
textSaleId.SetFocus
Exit Sub
End If
sql = "select 销售表.销售编号 as 销售编号,销售表.销售方式,商品表.商品名称 as 商品名称,销售表.售价,销售表.数量,销售表.结账方式,销售表.数额,"
sql = sql & "销售表.日期,销售表.备注"
sql = sql & " from 销售表,商品表 where 销售表.商品编号=商品表.商品编号 and 销售表.销售编号='" & strSearchId & "'"
adoSearchId.ConnectionString = ConnStr
adoSearchId.CommandType = adCmdText
adoSearchId.RecordSource = sql
adoSearchId.Refresh
If adoSearchId.Recordset.EOF Then
MsgBox "没有查询到相关记录,请重试!", vbInformation + vbOKOnly, "系统提示"
textSaleId.SetFocus
Exit Sub
End If
adoSearchId.Refresh
End Sub
Private Sub Form_Load()
Call loadXS(Me.Combo1)
End Sub
Private Sub Form_Resize()
Frame1.Width = frmSearchId.Width - 2 * 240
Frame1.Left = 240
Frame2.Width = frmSearchId.Width - 2 * 240
Frame2.Left = 240
If (frmSearchId.Height - 1560 - 600) < 0 Then
Frame2.Height = 400
Else
Frame2.Height = frmSearchId.Height - 1560 - 600
End If
DataGrid1.Width = Frame2.Width - 200
DataGrid1.Height = Frame2.Height - 400
End Sub
Private Sub Form_Unload(Cancel As Integer)
Set frmSearchId = Nothing
End Sub
Private Sub loadXS(combo As ComboBox) '加载销售编号的过程
Dim rsXS As ADODB.Recordset
Dim sqlXS As String
sqlXS = "select * from 销售表"
Set rsXS = ExeSQL(sqlXS)
combo.Clear
Do While Not rsXS.EOF
combo.AddItem (rsXS.Fields("销售编号"))
rsXS.MoveNext
Loop
combo.ListIndex = 0
rsXS.Close
Set rsXS = Nothing
Exit Sub
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -