Private cnDB As New ADODB.Connection
Private Rs As New ADODB.Recordset
Public QuerySQL As String '窗体显示时打开的表的SQL语句
Private gRow As Integer '记录MfgQuery中选中的行码
Private gCol As Integer '记录MfgQuery中选中的列码
Private gCondition As Integer '记录条件数,最多为5个条件Private Sub cmbCondition_LostFocus() '条件连接符
MfgQuery.TextMatrix(gRow, gCol) = Me.cmbCondition.Text
cmbCondition.Visible = False
End SubPrivate Sub cmdAdd_Click() '增加查询条件
Select Case LisFields.ItemData(LisFields.ListIndex) 'LisFields中选中字段的类型
Case 200, 201, 202, 203, 130 ' 字段类型为字符型
If Trim(Me.cmbValue.Text) <> "" Then '如果字段值不为空
gCondition = gCondition + 1
If Me.cmbOperator <> "Like" Then '如果运算符不为Like
If Me.cmbValue.Text = "(空值)" Then '如果选中的值为空值
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = "IS Null"
Else '如果选中的值为不空值
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = Me.cmbOperator & " '" & StrToSQL(Me.cmbValue) & "' "
End If
Else '如果运算符为Like
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = Me.cmbOperator & " '" & StrToSQL(Me.cmbValue) & "%' "
End If
Else '如果字段值为空
MsgBox "请在下拉列表中选取一项或填入要查询的值!", vbCritical + vbOKOnly, "提示"
Me.cmbValue.SetFocus
Exit Sub
End If
Case 2, 3, 4, 5, 6, 11, 131 '字段类型为数值型
If Trim(Me.cmbValue.Text) <> "" And IsNumeric(Me.cmbValue.Text) Then
gCondition = gCondition + 1
If Me.cmbOperator <> "Like" Then
If Me.cmbValue.Text = "(空值)" Then
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = "IS Null"
Else
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = Me.cmbOperator & " " & Me.cmbValue & " "
End If
Else
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = Me.cmbOperator & " '" & Me.cmbValue & "%' "
End If
Else
If Trim(Me.cmbValue.Text) <> "" Then
MsgBox "输入的值格式有错误,请重新输入!", vbCritical + vbOKOnly, "提示"
Else
MsgBox "请在下拉列表中选取一项或填入要查询的值!", vbCritical + vbOKOnly, "提示"
End If
Me.cmbValue.SetFocus
Exit Sub
End If
Case 135 '字段类型为日期型
If Me.DtpFrom.value <= Me.DTPTo.value Then
gCondition = gCondition + 1
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text
MfgQuery.TextMatrix(gCondition, 2) = " Between '" & Format(Me.DtpFrom.value, "yyyy-MM-dd") & "' And '" & Format(Me.DTPTo.value, "yyyy-MM-dd") & "'"
Else
MsgBox "终止日期小于起始日期!", vbCritical + vbOKOnly, "提示"
Me.DTPTo.SetFocus
Exit Sub
End If
End Select
If gCondition > 1 Then
Me.MfgQuery.TextMatrix(gCondition - 1, 3) = "And"
End If
Me.cmdYes.Enabled = True
Me.cmdRemove.Enabled = True
If gCondition = 5 Then
Me.cmdAdd.Enabled = False
End If
End SubPrivate Sub cmdRemove_Click() '移去最后一个查询条件
Dim i As Integer
For i = 1 To 3
Me.MfgQuery.TextMatrix(gCondition, i) = ""
Next
If gCondition - 1 > 0 Then
Me.MfgQuery.TextMatrix(gCondition - 1, 3) = ""
End If
Me.cmdAdd.Enabled = True
gCondition = gCondition - 1
If gCondition = 0 Then
Me.cmdRemove.Enabled = False
Me.cmdYes.Enabled = False
End If
End SubPrivate Sub cmdYes_Click() '生成查询条件语句
Dim i As Integer
Dim mSQL As String
gQuerySQL = ""
mSQL = ""
For i = 1 To Me.MfgQuery.Rows - 1
If Trim(Me.MfgQuery.TextMatrix(i, 1)) <> "" Then '如果查询条件中的字段名称不为空
mSQL = Me.MfgQuery.TextMatrix(i, 1) & " " & Me.MfgQuery.TextMatrix(i, 2)
Select Case i
Case 1
gQuerySQL = gQuerySQL & mSQL
Case Else
gQuerySQL = gQuerySQL & " " & Me.MfgQuery.TextMatrix(i - 1, 3) & " " & mSQL
End Select
Else '如果查询条件中的字段名称为空
Exit For '退出循环
End If
Next
If Trim(gQuerySQL) <> "" Then
gQuerySQL = "Where " & gQuerySQL
Else
gQuerySQL = ""
End If
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
gQuerySQL = ""
If mServer = True Then
cnDB.ConnectionString = "PROVIDER=MSDASQL;driver={SQL Server};server=cai;uid=sunnycai;pwd=sunny;database=Storage;" '"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & ";Persist Security Info=False"
Else
cnDB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & ";Persist Security Info=False"
End If
cnDB.CommandTimeout = 15
cnDB.Open
Rs.Open QuerySQL, cnDB, adOpenStatic, adLockReadOnly
For i = 0 To Rs.Fields.Count - 1
LisFields.AddItem Rs.Fields(i).Name
LisFields.ItemData(LisFields.NewIndex) = Rs.Fields(i).Type
Next
gCondition = 0
'----------- 格式化mfgQuery -------
MfgQuery.TextMatrix(0, 0) = "条件"
MfgQuery.TextMatrix(0, 1) = "字段名称"
MfgQuery.TextMatrix(0, 2) = "查询值"
MfgQuery.TextMatrix(0, 3) = "连接条件"
MfgQuery.ColWidth(0) = 260
MfgQuery.ColWidth(1) = 1515
MfgQuery.ColWidth(2) = 2250
MfgQuery.ColWidth(3) = 930
MfgQuery.RowHeight(0) = 800
For i = 1 To MfgQuery.Rows - 1
MfgQuery.TextMatrix(i, 0) = i
MfgQuery.RowHeight(i) = 750
Next
End SubPrivate Sub cmdNo_Click()
gQuerySQL = ""
Unload Me
End SubPrivate Sub Form_Unload(Cancel As Integer)
Rs.Close
cnDB.Close
Set cnDB = Nothing
End SubPrivate Sub LisFields_Click() '选中字段列表框
If LisFields.ItemData(LisFields.ListIndex) <> "135" Then '如果选中的字段不是日期类型
fraValue1.Visible = True
fraValue1.Enabled = True
fraValue2.Visible = False
Me.cmbOperator.ListIndex = 0
cmbValue.Clear
cmbValue.AddItem "(空值)"
If Not Rs.EOF Or Not Rs.BOF Then
Rs.MoveFirst
Do While Not Rs.EOF '列出选中字段的可能值
cmbValue.AddItem Rs.Fields(LisFields.ListIndex)
Rs.MoveNext
Loop
End If
Else '如果选中的字段是日期类型
fraValue2.Visible = True
fraValue1.Visible = False
Me.DtpFrom.value = Format(Now, "yyyy-MM-dd")
Me.DTPTo.value = Format(Now, "yyyy-MM-dd")
End If
Me.cmdAdd.Enabled = True
End SubPrivate Sub MSHFlexGridEdit(MSHFlexGrid As Control, Cmb As Control) '在MfgQuery选中的格上显示下拉选框
Cmb.Move MSHFlexGrid.Left + MSHFlexGrid.CellLeft - 10, _
MSHFlexGrid.Top + MSHFlexGrid.CellTop - 10, _
MSHFlexGrid.CellWidth
Cmb.Visible = True
Cmb.ListIndex = 0
MSHFlexGrid.TextMatrix(gRow, gCol) = ""
Cmb.SetFocus
End Sub
Private Sub MfgQuery_Click() '选中mfgQuery
gRow = MfgQuery.Row
gCol = MfgQuery.Col
If MfgQuery.Col = 3 Then
If Trim(MfgQuery.TextMatrix(gRow, 1)) <> "" And MfgQuery.Row <> 5 Then '当选中的列为第四列并且不是最后一行时
MSHFlexGridEdit MfgQuery, Me.cmbCondition '显示下拉选框
End If
End If
End SubPrivate Sub MfgQuery_KeyPress(KeyAscii As Integer)
gRow = MfgQuery.Row
gCol = MfgQuery.Col
If MfgQuery.Col = 3 Then
If Trim(MfgQuery.TextMatrix(gRow, 1)) <> "" And MfgQuery.Row <> 5 Then '当选中的列为第四列并且不是最后一行时
MSHFlexGridEdit MfgQuery, Me.cmbCondition '显示下拉选框
End If
End If
End Sub
Private Rs As New ADODB.Recordset
Public QuerySQL As String '窗体显示时打开的表的SQL语句
Private gRow As Integer '记录MfgQuery中选中的行码
Private gCol As Integer '记录MfgQuery中选中的列码
Private gCondition As Integer '记录条件数,最多为5个条件Private Sub cmbCondition_LostFocus() '条件连接符
MfgQuery.TextMatrix(gRow, gCol) = Me.cmbCondition.Text
cmbCondition.Visible = False
End SubPrivate Sub cmdAdd_Click() '增加查询条件
Select Case LisFields.ItemData(LisFields.ListIndex) 'LisFields中选中字段的类型
Case 200, 201, 202, 203, 130 ' 字段类型为字符型
If Trim(Me.cmbValue.Text) <> "" Then '如果字段值不为空
gCondition = gCondition + 1
If Me.cmbOperator <> "Like" Then '如果运算符不为Like
If Me.cmbValue.Text = "(空值)" Then '如果选中的值为空值
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = "IS Null"
Else '如果选中的值为不空值
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = Me.cmbOperator & " '" & StrToSQL(Me.cmbValue) & "' "
End If
Else '如果运算符为Like
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = Me.cmbOperator & " '" & StrToSQL(Me.cmbValue) & "%' "
End If
Else '如果字段值为空
MsgBox "请在下拉列表中选取一项或填入要查询的值!", vbCritical + vbOKOnly, "提示"
Me.cmbValue.SetFocus
Exit Sub
End If
Case 2, 3, 4, 5, 6, 11, 131 '字段类型为数值型
If Trim(Me.cmbValue.Text) <> "" And IsNumeric(Me.cmbValue.Text) Then
gCondition = gCondition + 1
If Me.cmbOperator <> "Like" Then
If Me.cmbValue.Text = "(空值)" Then
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = "IS Null"
Else
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = Me.cmbOperator & " " & Me.cmbValue & " "
End If
Else
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text & " "
MfgQuery.TextMatrix(gCondition, 2) = Me.cmbOperator & " '" & Me.cmbValue & "%' "
End If
Else
If Trim(Me.cmbValue.Text) <> "" Then
MsgBox "输入的值格式有错误,请重新输入!", vbCritical + vbOKOnly, "提示"
Else
MsgBox "请在下拉列表中选取一项或填入要查询的值!", vbCritical + vbOKOnly, "提示"
End If
Me.cmbValue.SetFocus
Exit Sub
End If
Case 135 '字段类型为日期型
If Me.DtpFrom.value <= Me.DTPTo.value Then
gCondition = gCondition + 1
MfgQuery.TextMatrix(gCondition, 1) = Me.LisFields.Text
MfgQuery.TextMatrix(gCondition, 2) = " Between '" & Format(Me.DtpFrom.value, "yyyy-MM-dd") & "' And '" & Format(Me.DTPTo.value, "yyyy-MM-dd") & "'"
Else
MsgBox "终止日期小于起始日期!", vbCritical + vbOKOnly, "提示"
Me.DTPTo.SetFocus
Exit Sub
End If
End Select
If gCondition > 1 Then
Me.MfgQuery.TextMatrix(gCondition - 1, 3) = "And"
End If
Me.cmdYes.Enabled = True
Me.cmdRemove.Enabled = True
If gCondition = 5 Then
Me.cmdAdd.Enabled = False
End If
End SubPrivate Sub cmdRemove_Click() '移去最后一个查询条件
Dim i As Integer
For i = 1 To 3
Me.MfgQuery.TextMatrix(gCondition, i) = ""
Next
If gCondition - 1 > 0 Then
Me.MfgQuery.TextMatrix(gCondition - 1, 3) = ""
End If
Me.cmdAdd.Enabled = True
gCondition = gCondition - 1
If gCondition = 0 Then
Me.cmdRemove.Enabled = False
Me.cmdYes.Enabled = False
End If
End SubPrivate Sub cmdYes_Click() '生成查询条件语句
Dim i As Integer
Dim mSQL As String
gQuerySQL = ""
mSQL = ""
For i = 1 To Me.MfgQuery.Rows - 1
If Trim(Me.MfgQuery.TextMatrix(i, 1)) <> "" Then '如果查询条件中的字段名称不为空
mSQL = Me.MfgQuery.TextMatrix(i, 1) & " " & Me.MfgQuery.TextMatrix(i, 2)
Select Case i
Case 1
gQuerySQL = gQuerySQL & mSQL
Case Else
gQuerySQL = gQuerySQL & " " & Me.MfgQuery.TextMatrix(i - 1, 3) & " " & mSQL
End Select
Else '如果查询条件中的字段名称为空
Exit For '退出循环
End If
Next
If Trim(gQuerySQL) <> "" Then
gQuerySQL = "Where " & gQuerySQL
Else
gQuerySQL = ""
End If
Unload Me
End Sub
Private Sub Form_Load()
Dim i As Integer
gQuerySQL = ""
If mServer = True Then
cnDB.ConnectionString = "PROVIDER=MSDASQL;driver={SQL Server};server=cai;uid=sunnycai;pwd=sunny;database=Storage;" '"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & ";Persist Security Info=False"
Else
cnDB.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBPath & ";Persist Security Info=False"
End If
cnDB.CommandTimeout = 15
cnDB.Open
Rs.Open QuerySQL, cnDB, adOpenStatic, adLockReadOnly
For i = 0 To Rs.Fields.Count - 1
LisFields.AddItem Rs.Fields(i).Name
LisFields.ItemData(LisFields.NewIndex) = Rs.Fields(i).Type
Next
gCondition = 0
'----------- 格式化mfgQuery -------
MfgQuery.TextMatrix(0, 0) = "条件"
MfgQuery.TextMatrix(0, 1) = "字段名称"
MfgQuery.TextMatrix(0, 2) = "查询值"
MfgQuery.TextMatrix(0, 3) = "连接条件"
MfgQuery.ColWidth(0) = 260
MfgQuery.ColWidth(1) = 1515
MfgQuery.ColWidth(2) = 2250
MfgQuery.ColWidth(3) = 930
MfgQuery.RowHeight(0) = 800
For i = 1 To MfgQuery.Rows - 1
MfgQuery.TextMatrix(i, 0) = i
MfgQuery.RowHeight(i) = 750
Next
End SubPrivate Sub cmdNo_Click()
gQuerySQL = ""
Unload Me
End SubPrivate Sub Form_Unload(Cancel As Integer)
Rs.Close
cnDB.Close
Set cnDB = Nothing
End SubPrivate Sub LisFields_Click() '选中字段列表框
If LisFields.ItemData(LisFields.ListIndex) <> "135" Then '如果选中的字段不是日期类型
fraValue1.Visible = True
fraValue1.Enabled = True
fraValue2.Visible = False
Me.cmbOperator.ListIndex = 0
cmbValue.Clear
cmbValue.AddItem "(空值)"
If Not Rs.EOF Or Not Rs.BOF Then
Rs.MoveFirst
Do While Not Rs.EOF '列出选中字段的可能值
cmbValue.AddItem Rs.Fields(LisFields.ListIndex)
Rs.MoveNext
Loop
End If
Else '如果选中的字段是日期类型
fraValue2.Visible = True
fraValue1.Visible = False
Me.DtpFrom.value = Format(Now, "yyyy-MM-dd")
Me.DTPTo.value = Format(Now, "yyyy-MM-dd")
End If
Me.cmdAdd.Enabled = True
End SubPrivate Sub MSHFlexGridEdit(MSHFlexGrid As Control, Cmb As Control) '在MfgQuery选中的格上显示下拉选框
Cmb.Move MSHFlexGrid.Left + MSHFlexGrid.CellLeft - 10, _
MSHFlexGrid.Top + MSHFlexGrid.CellTop - 10, _
MSHFlexGrid.CellWidth
Cmb.Visible = True
Cmb.ListIndex = 0
MSHFlexGrid.TextMatrix(gRow, gCol) = ""
Cmb.SetFocus
End Sub
Private Sub MfgQuery_Click() '选中mfgQuery
gRow = MfgQuery.Row
gCol = MfgQuery.Col
If MfgQuery.Col = 3 Then
If Trim(MfgQuery.TextMatrix(gRow, 1)) <> "" And MfgQuery.Row <> 5 Then '当选中的列为第四列并且不是最后一行时
MSHFlexGridEdit MfgQuery, Me.cmbCondition '显示下拉选框
End If
End If
End SubPrivate Sub MfgQuery_KeyPress(KeyAscii As Integer)
gRow = MfgQuery.Row
gCol = MfgQuery.Col
If MfgQuery.Col = 3 Then
If Trim(MfgQuery.TextMatrix(gRow, 1)) <> "" And MfgQuery.Row <> 5 Then '当选中的列为第四列并且不是最后一行时
MSHFlexGridEdit MfgQuery, Me.cmbCondition '显示下拉选框
End If
End If
End Sub
Object = "{2B12169D-6738-11D2-BF5B-00A024982E5B}#29.1#0"; "AXBUTTON.OCX"
Object = "{0ECD9B60-23AA-11D0-B351-00A0C9055D8E}#6.0#0"; "MSHFLXGD.OCX"
Object = "{86CF1D34-0C5F-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCT2.OCX"
Begin VB.Form FrmQuery
BorderStyle = 3 'Fixed Dialog
Caption = "查询条件"
ClientHeight = 5775
ClientLeft = 840
ClientTop = 1815
ClientWidth = 10485
Icon = "FrmQuery.frx":0000
LinkTopic = "Form1"
LockControls = -1 'True
MaxButton = 0 'False
MinButton = 0 'False
ScaleHeight = 5775
ScaleWidth = 10485
ShowInTaskbar = 0 'False
Begin VB.CommandButton cmdRemove
Caption = "移除"
Enabled = 0 'False
Height = 765
Left = 4815
Picture = "FrmQuery.frx":0E42
Style = 1 'Graphical
TabIndex = 21
Top = 3240
Width = 480
End
Begin VB.CommandButton cmdAdd
Caption = "添加"
Enabled = 0 'False
Height = 765
Left = 4815
Picture = "FrmQuery.frx":14D8
Style = 1 'Graphical
TabIndex = 16
Top = 2055
Width = 480
End
Begin VB.Frame fraQuery1
Caption = "定义查询条件"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4935
Left = 15
TabIndex = 4
Top = 780
Width = 4755
Begin axButtonControl.axButton axButton4
Height = 315
Left = 45
TabIndex = 18
Top = 285
Width = 2370
_ExtentX = 4180
_ExtentY = 556
BackColor = -2147483636
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Caption = "查询字段列表 "
MaskColor = -2147483633
Style = 1
End
Begin VB.ListBox LisFields
Columns = 1
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4260
ItemData = "FrmQuery.frx":1B6E
Left = 45
List = "FrmQuery.frx":1B70
TabIndex = 5
Top = 615
Width = 2370
End
Begin VB.Frame fraValue1
Enabled = 0 'False
Height = 4680
Left = 2430
TabIndex = 6
Top = 195
Width = 2265
Begin VB.ComboBox cmbOperator
Height = 300
ItemData = "FrmQuery.frx":1B72
Left = 105
List = "FrmQuery.frx":1B8B
Style = 2 'Dropdown List
TabIndex = 8
Top = 915
Width = 1800
End
Begin VB.ComboBox cmbValue
Height = 300
Left = 105
TabIndex = 7
Top = 1785
Width = 1800
End
Begin VB.Label Label2
AutoSize = -1 'True
Caption = "运算符"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 105
TabIndex = 10
Top = 630
Width = 630
End
Begin VB.Label Label3
AutoSize = -1 'True
Caption = "值"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 105
TabIndex = 9
Top = 1485
Width = 210
End
End
Begin VB.Frame fraValue2
Height = 4680
Left = 2430
TabIndex = 11
Top = 195
Visible = 0 'False
Width = 2265
Begin MSComCtl2.DTPicker DtpFrom
Height = 330
Left = 135
TabIndex = 12
ToolTipText = "选择入库日期"
Top = 900
Width = 2085
_ExtentX = 3678
_ExtentY = 582
_Version = 393216
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
CalendarBackColor= -2147483624
CalendarTitleBackColor= 32768
CalendarTitleForeColor= -2147483639
CalendarTrailingForeColor= 12632256
CustomFormat = "yyyy-MM-dd"
Format = 24576000
CurrentDate = 37382
End
Begin MSComCtl2.DTPicker DTPTo
Height = 330
Left = 135
TabIndex = 13
ToolTipText = "选择入库日期"
Top = 1710
Width = 2085
_ExtentX = 3678
_ExtentY = 582
_Version = 393216
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
CalendarBackColor= -2147483624
CalendarTitleBackColor= 32768
CalendarTitleForeColor= -2147483639
CalendarTrailingForeColor= 12632256
CustomFormat = "yyyy-MM-dd"
Format = 24576000
CurrentDate = 37382
End
Begin VB.Label Label10
AutoSize = -1 'True
Caption = "起始日期"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 105
TabIndex = 15
Top = 645
Width = 840
End
Begin VB.Label Label11
AutoSize = -1 'True
Caption = "终止日期"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 210
Left = 120
TabIndex = 14
Top = 1395
Width = 840
End
End
End
Begin VB.CommandButton cmdNo
Caption = "取消"
Height = 510
Left = 675
Picture = "FrmQuery.frx":1BAA
Style = 1 'Graphical
TabIndex = 1
ToolTipText = "取消操作,并退出选择窗口"
Top = 45
Width = 525
End
Begin VB.CommandButton cmdYes
Caption = "确定"
Enabled = 0 'False
Height = 510
Left = 150
Picture = "FrmQuery.frx":2174
Style = 1 'Graphical
TabIndex = 0
ToolTipText = "确定选取的内容"
Top = 45
Width = 525
End
Begin axButtonControl.axButton axButton2
Height = 540
Left = 30
TabIndex = 2
Top = 15
Width = 120
_ExtentX = 212
_ExtentY = 953
ForeColor = -2147483631
Enabled = 0 'False
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MaskColor = -2147483633
Style = 4
ColorDarkShadow = -2147483633
ColorLightShadow= -2147483633
End
Begin axButtonControl.axButton axButton1
Height = 600
Left = 0
TabIndex = 3
Top = 0
Width = 10470
_ExtentX = 18468
_ExtentY = 1058
Enabled = 0 'False
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
MaskColor = -2147483633
Style = 1
End
Begin VB.Frame fraQuery2
Caption = "已定义的查询条件"
BeginProperty Font
Name = "宋体"
Size = 10.5
Charset = 134
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 4935
Left = 5325
TabIndex = 17
Top = 780
Width = 5145
Begin VB.ComboBox cmbCondition
Height = 300
ItemData = "FrmQuery.frx":26FE
Left = 2715
List = "FrmQuery.frx":2708
Style = 2 'Dropdown List
TabIndex = 20
Top = 2580
Visible = 0 'False
Width = 1095
End
Begin MSHierarchicalFlexGridLib.MSHFlexGrid MfgQuery
Height = 4635
Left = 45
TabIndex = 19
Top = 240
Width = 5040
_ExtentX = 8890
_ExtentY = 8176
_Version = 393216
BackColor = -2147483628
Rows = 6
Cols = 4
BackColorFixed = -2147483624
BackColorSel = 16752029
ForeColorSel = -2147483625
BackColorBkg = -2147483628
WordWrap = -1 'True
AllowBigSelection= 0 'False
AllowUserResizing= 3
RowSizingMode = 1
BeginProperty FontFixed {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "宋体"
Size = 9
Charset = 134
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
_NumberOfBands = 1
_Band(0).Cols = 4
_Band(0).GridLinesBand= 1
_Band(0).TextStyleBand= 0
_Band(0).TextStyleHeader= 0
End
End
End
Attribute VB_Name = "FrmQuery"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attri
[email protected]
多谢!好复杂啊!
提示没有找到方法或数据成员
MfgQuery是VB中的MSHFlexGrid,TextMatrix方法肯定是有的。
你建一个工程,然后把窗体加上去,再加多一个窗体和一按钮
Private Sub cmdSearch_Click()
FrmQuery.QuerySQL = "SELECT * From YourTable"
FrmQuery.Show 1
end sub
试试吧.
把其中你没有的控件删了。
行 58: 控件 axButton4 的类 axButtonControl.axButton 不是一个已加载的控件类。
行 282: 控件 axButton2 的类 axButtonControl.axButton 不是一个已加载的控件类。
行 306: 控件 axButton1 的类 axButtonControl.axButton 不是一个已加载的控件类。
行 64: 属性名 _ExtentX 在 axButton4 中是无效的。
行 65: 属性名 _ExtentY 在 axButton4 中是无效的。
行 76: 属性名 Caption 在 axButton4 中是无效的。
行 77: 属性名 MaskColor 在 axButton4 中是无效的。
行 78: 属性名 Style 在 axButton4 中是无效的。
行 288: 属性名 _ExtentX 在 axButton2 中是无效的。
行 289: 属性名 _ExtentY 在 axButton2 中是无效的。
行 301: 属性名 MaskColor 在 axButton2 中是无效的。
行 302: 属性名 Style 在 axButton2 中是无效的。
行 303: 属性名 ColorDarkShadow 在 axButton2 中是无效的。
行 304: 属性名 ColorLightShadow 在 axButton2 中是无效的。
行 312: 属性名 _ExtentX 在 axButton1 中是无效的。
行 313: 属性名 _ExtentY 在 axButton1 中是无效的。
行 324: 属性名 MaskColor 在 axButton1 中是无效的。
行 325: 属性名 Style 在 axButton1 中是无效的。
我用的是VB6.0,是不是有这关系?