📄 grid of seed crushing.frm
字号:
Picture = "grid of seed crushing.frx":0000
Top = 6600
Width = 615
End
Begin VB.Label Label3
BackColor = &H80000013&
Height = 6735
Left = 10080
TabIndex = 15
Top = 0
Width = 375
End
Begin VB.Image Image2
Height = 915
Left = -480
Picture = "grid of seed crushing.frx":141E
Top = 7200
Width = 10620
End
Begin VB.Image Image1
Height = 8100
Left = 10120
Picture = "grid of seed crushing.frx":20E7C
Top = 0
Width = 1800
End
Begin VB.Label Label1
BackColor = &H80000013&
Caption = "Search Seed Crushing Detail"
BeginProperty Font
Name = "Times New Roman"
Size = 24
Charset = 0
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 615
Left = 2040
TabIndex = 0
Top = 360
Width = 6015
End
End
Attribute VB_Name = "Form18"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public callingform As Object
Dim rs1 As New ADODB.Recordset
Dim rs As New ADODB.Recordset
Dim cnn As New ADODB.Connection
Private Sub Command1_Click()
Unload Me
'37.324
End Sub
Private Sub Command2_Click()
Grid1.clear
Grid1.Rows = 2
Grid1.TextMatrix(0, 0) = "Crushing No"
Grid1.TextMatrix(0, 1) = "Crushing Date"
Grid1.TextMatrix(0, 2) = "Seed Used(Mn)"
Grid1.TextMatrix(0, 3) = "Cotton Prod(Mn)"
Grid1.TextMatrix(0, 4) = "Crude Oil Prod(Mn)"
Grid1.TextMatrix(0, 5) = "Cake Prod(Mn)"
Grid1.TextMatrix(0, 6) = "Shortage"
If Option1.Value = False And Option2.Value = False Then
MsgBox "First Select an Option"
Exit Sub
End If
'//////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open " SeedCrtshing ", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox " No Record Exists"
Exit Sub
End If
'///////////////////
If Option2.Value = True Then
If crush.Text = "" Then
MsgBox "Enter the Crushing No"
crush.SetFocus
Exit Sub
End If
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "select * from SeedCrtshing where SCrNo=" & Val(crush.Text), cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox "This Crushing No Record does not Exists"
Exit Sub
Else
rs1.MoveFirst
While Not rs1.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs1.Fields("SCrNo")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs1.Fields("CrDate")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs1.Fields("SMnUsed")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs1.Fields("DCMnProduced")
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("CrudeOilMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs1.Fields("OilCakeMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs1.Fields("ShortageMn")
Grid1.Rows = Grid1.Rows + 1
rs1.MoveNext
Wend
End If
End If
If Option1.Value = True Then
atta
End If
End Sub
Private Sub Command4_Click()
End Sub
Private Sub Command5_Click()
End Sub
Private Sub Form_Load()
Grid1.ColWidth(0) = 1200
Grid1.ColWidth(1) = 1200
Grid1.ColWidth(2) = 1200
Grid1.ColWidth(3) = 1300
Grid1.ColWidth(4) = 1500
Grid1.ColWidth(5) = 1200
Grid1.ColWidth(6) = 1200
Grid1.TextMatrix(0, 0) = "Crushing No"
Grid1.TextMatrix(0, 1) = "Crushing Date"
Grid1.TextMatrix(0, 2) = "Seed Used(Mn)"
Grid1.TextMatrix(0, 3) = "Cotton Prod(Mn)"
Grid1.TextMatrix(0, 4) = "Crude Oil Prod(Mn)"
Grid1.TextMatrix(0, 5) = "Cake Prod(Mn)"
Grid1.TextMatrix(0, 6) = "Shortage"
If cnn.State = adStateOpen Then cnn.Close
cnn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=hussain"
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "SeedCrtshing", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount > 0 Then
rs1.MoveFirst
While Not rs1.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs1.Fields("SCrNo")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs1.Fields("CrDate")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs1.Fields("SMnUsed")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs1.Fields("DCMnProduced")
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("CrudeOilMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs1.Fields("OilCakeMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs1.Fields("ShortageMn")
Grid1.Rows = Grid1.Rows + 1
rs1.MoveNext
Wend
'fdate.Value = Now
'tdate.Value = Now
End If
End Sub
Private Sub Option1_Click()
crush.Text = ""
crush.Enabled = False
fdate.Enabled = True
tdate.Enabled = True
fdate.SetFocus
End Sub
Private Sub Option2_Click()
crush.Text = ""
fdate.Enabled = False
tdate.Enabled = False
crush.Enabled = True
crush.SetFocus
End Sub
Private Sub select_Click()
'/////////////////////////////
If callingform.Name = "MDIForm1" Then
Exit Sub
End If
'///////////////////////////
'/////////////////////////////
If callingform.Name = "Form9" Then
If Grid1.TextMatrix(Grid1.RowSel, 0) = "" Then
MsgBox "No Record Exists"
Exit Sub
Else
callingform.crno.Text = Grid1.TextMatrix(Grid1.RowSel, 0)
callingform.Text1.Text = Grid1.TextMatrix(Grid1.RowSel, 1)
callingform.smnused.Text = Grid1.TextMatrix(Grid1.RowSel, 2)
a = Val(Grid1.TextMatrix(Grid1.RowSel, 2)) * 37.324
Form9.skg.Text = CStr(Round(a, 0))
callingform.dcmnproduced.Text = Grid1.TextMatrix(Grid1.RowSel, 3)
b = Val(Grid1.TextMatrix(Grid1.RowSel, 3)) * 37.324
Form9.dkg.Text = CStr(Round(b, 0))
callingform.crudeoilmnprod.Text = Grid1.TextMatrix(Grid1.RowSel, 4)
c = Val(Grid1.TextMatrix(Grid1.RowSel, 4)) * 37.324
Form9.ckg.Text = CStr(Round(c, 0))
callingform.oilcakemnprod.Text = Grid1.TextMatrix(Grid1.RowSel, 5)
d = Val(Grid1.TextMatrix(Grid1.RowSel, 5)) * 37.324
Form9.okg.Text = CStr(Round(d, 0))
callingform.shortage.Text = Grid1.TextMatrix(Grid1.RowSel, 6)
e = Val(Grid1.TextMatrix(Grid1.RowSel, 6)) * 37.324
Form9.shkg.Text = CStr(Round(e, 0))
Unload Me
Exit Sub
End If
End If
'////////////////////////
End Sub
Public Sub atta()
If Option1.Value = True Then
If fdate.Value = "" Then
MsgBox "Please Enter the From Date"
fdate.SetFocus
Exit Sub
End If
'///////////////////
If Option1.Value = True Then
If fdate.Value > tdate.Value Then
MsgBox "From Date must be smaller than the ToDate"
fdate.SetFocus
Exit Sub
Else
'////////////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open " select * from SeedCrtshing where CrDate>='" & fdate.Value & " ' and CrDate <='" & tdate.Value & " '", cnn, adOpenStatic, adLockReadOnly
If rs1.RecordCount = 0 Then
MsgBox "Seed is not Crushed between these dates"
Exit Sub
Else
rs1.MoveFirst
While Not rs1.EOF
Grid1.TextMatrix(Grid1.Rows - 1, 0) = rs1.Fields("SCrNo")
Grid1.TextMatrix(Grid1.Rows - 1, 1) = rs1.Fields("CrDate")
Grid1.TextMatrix(Grid1.Rows - 1, 2) = rs1.Fields("SMnUsed")
Grid1.TextMatrix(Grid1.Rows - 1, 3) = rs1.Fields("DCMnProduced")
Grid1.TextMatrix(Grid1.Rows - 1, 4) = rs1.Fields("CrudeOilMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 5) = rs1.Fields("OilCakeMnProd")
Grid1.TextMatrix(Grid1.Rows - 1, 6) = rs1.Fields("ShortageMn")
Grid1.Rows = Grid1.Rows + 1
rs1.MoveNext
Wend
End If
End If
End If
End If
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -