📄 unioncha1.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"
Object = "{F9043C88-F6F2-101A-A3C9-08002B2F49FB}#1.2#0"; "COMDLG32.OCX"
Begin VB.Form unioncha1
Caption = "厂家表与产品表联结查询"
ClientHeight = 4725
ClientLeft = 60
ClientTop = 345
ClientWidth = 8925
ControlBox = 0 'False
Icon = "unioncha1.frx":0000
LinkTopic = "Form1"
MDIChild = -1 'True
ScaleHeight = 4725
ScaleWidth = 8925
WindowState = 2 'Maximized
Begin VB.Frame Frame1
Height = 4455
Left = 120
TabIndex = 0
Top = 120
Width = 8685
Begin MSComDlg.CommonDialog CommonDialog1
Left = 7080
Top = 120
_ExtentX = 847
_ExtentY = 847
_Version = 393216
End
Begin VB.CommandButton Command2
Caption = "打 印"
Height = 275
Left = 5520
TabIndex = 5
Top = 140
Width = 1215
End
Begin VB.CommandButton Command1
Caption = "查 询"
Height = 275
Left = 4080
TabIndex = 4
Top = 140
Width = 1215
End
Begin VB.ComboBox Combo1
Height = 300
ItemData = "unioncha1.frx":08CA
Left = 1320
List = "unioncha1.frx":08E0
TabIndex = 3
Text = "厂家表与产品表全部查询"
Top = 120
Width = 2415
End
Begin MSAdodcLib.Adodc Adodc1
Height = 375
Left = 120
Top = 3960
Width = 8415
_ExtentX = 14843
_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 = "Adodc1"
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
Height = 3375
Left = 120
TabIndex = 1
Top = 480
Width = 8415
_ExtentX = 14843
_ExtentY = 5953
_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
Begin VB.Label Label1
Caption = "分类查询选择:"
Height = 255
Left = 120
TabIndex = 2
Top = 240
Width = 1335
End
End
End
Attribute VB_Name = "unioncha1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private rs As New ADODB.Recordset
Private strconn As String
Private flag As Integer
Private Sub Command1_Click()
If Combo1.Text = "电话" Then
strcha = "select 厂家.厂家名称,厂家.地址,厂家.电话,产品.产品名称,产品.规格,产品.单价,厂家.年总产值,厂家.利润 from 厂家,产品 where 厂家.厂家名称=产品.生产厂家 and 产品.产品名称 = '电话'"
flag = 1
End If
If Combo1.Text = "彩电" Then
strcha = "select 厂家.厂家名称,厂家.地址,厂家.电话,产品.产品名称,产品.规格,产品.单价,厂家.年总产值,厂家.利润 from 厂家,产品 where 厂家.厂家名称=产品.生产厂家 and 产品.产品名称 = '彩电'"
flag = 1
End If
If Combo1.Text = "电缆" Then
strcha = "select 厂家.厂家名称,厂家.地址,厂家.电话,产品.产品名称,产品.规格,产品.单价,厂家.年总产值,厂家.利润 from 厂家,产品 where 厂家.厂家名称=产品.生产厂家 and 产品.产品名称 = '电缆'"
flag = 1
End If
If Combo1.Text = "冰箱" Then
strcha = "select 厂家.厂家名称,厂家.地址,厂家.电话,产品.产品名称,产品.规格,产品.单价,厂家.年总产值,厂家.利润 from 厂家,产品 where 厂家.厂家名称=产品.生产厂家 and 产品.产品名称 = '冰箱'"
flag = 1
End If
If Combo1.Text = "空调器" Then
strcha = "select 厂家.厂家名称,厂家.地址,厂家.电话,产品.产品名称,产品.规格,产品.单价,厂家.年总产值,厂家.利润 from 厂家,产品 where 厂家.厂家名称=产品.生产厂家 and 产品.产品名称 = '空调器'"
flag = 1
End If
If Combo1.Text = "厂家表与产品表全部查询" Then
strcha = "select * from 厂家,产品 where 厂家.厂家名称=产品.生产厂家"
flag = 0
End If
Call chuanchian
End Sub
Private Sub Command2_Click()
On Error Resume Next
CommonDialog1.ShowPrinter
End Sub
Private Sub Form_Load()
flag = 0
unioform1 = 1
mainmdiform.Toolbar1.Buttons(6).Enabled = False
mainmdiform.Toolbar1.Buttons(7).Enabled = False
mainmdiform.Toolbar1.Buttons(10).Enabled = False
mainmdiform.Toolbar1.Buttons(11).Enabled = False
mainmdiform.StatusBar1.SimpleText = "正在查阅... ...厂家表与产品表联结查询表单"
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\供销信息.mdb"
strcha = "select * from 厂家,产品 where 厂家.厂家名称=产品.生产厂家"
With rs
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strcha
.LockType = adLockReadOnly
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
sst = 1
lastid = (Adodc1.Recordset.RecordCount + 1)
Adodc1.Caption = "当前记录为:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
End Sub
Sub chuanchian()
strconn = "provider=microsoft.jet.oledb.4.0;data source=" & App.Path & "\供销信息.mdb"
With rs
If .State = adStateOpen Then
.Close
End If
.ActiveConnection = strconn
.Source = strcha
.LockType = adLockOptimistic
.CursorLocation = adUseClient
.CursorType = adOpenDynamic
.Open
End With
Set DataGrid1.DataSource = rs
Set Adodc1.Recordset = rs
sst = 1
lastid = (Adodc1.Recordset.RecordCount + 1)
Adodc1.Caption = "当前记录为:" & Adodc1.Recordset.AbsolutePosition & "/" & Adodc1.Recordset.RecordCount
If flag = 1 Then
With DataGrid1
.Columns(0).Width = 1200
.Columns(1).Width = 1400
.Columns(2).Width = 800
.Columns(3).Width = 800
.Columns(4).Width = 1200
.Columns(5).Width = 600
.Columns(6).Width = 1100
.Columns(7).Width = 1000
End With
End If
End Sub
Private Sub Form_Resize()
If unioncha1.WindowState = 0 Then
unioncha1.WindowState = 2
End If
End Sub
Private Sub Form_Unload(Cancel As Integer)
mainmdiform.Toolbar1.Buttons(6).Enabled = True
mainmdiform.Toolbar1.Buttons(7).Enabled = True
mainmdiform.Toolbar1.Buttons(10).Enabled = True
mainmdiform.Toolbar1.Buttons(11).Enabled = True
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -