📄 supplier broker buyer information.frm
字号:
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 480
TabIndex = 10
Top = 1320
Width = 1935
End
Begin VB.Label Label2
BackStyle = 0 'Transparent
Caption = "Supplier Name"
BeginProperty Font
Name = "Times New Roman"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 480
TabIndex = 9
Top = 840
Width = 1695
End
Begin VB.Label Label1
BackStyle = 0 'Transparent
Caption = "Supplier Code"
BeginProperty Font
Name = "Times New Roman"
Size = 11.25
Charset = 0
Weight = 700
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 480
TabIndex = 8
Top = 360
Width = 1695
End
End
Begin VB.Image Image6
Height = 675
Left = 6415
Picture = "supplier broker buyer information.frx":0000
Top = 4780
Width = 690
End
Begin VB.Image Image2
Height = 825
Left = -820
Picture = "supplier broker buyer information.frx":18DE
Top = 5320
Width = 7545
End
Begin VB.Label Label6
BackColor = &H80000013&
Height = 6015
Left = 6600
TabIndex = 16
Top = -960
Width = 375
End
Begin VB.Image Image5
Height = 615
Left = 3720
Top = 5400
Width = 855
End
Begin VB.Image Image1
Height = 5985
Left = 6720
Picture = "supplier broker buyer information.frx":15DF8
Top = -40
Width = 1395
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "Supplier Registration"
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 = 1200
TabIndex = 12
Top = 360
Width = 4695
End
End
Attribute VB_Name = "Form15"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Dim cnn As ADODB.Connection
Dim rs As New ADODB.Recordset
Dim rs1 As New ADODB.Recordset
Private Sub Command1_Click()
If supname.Text = "" Then
MsgBox "Please enter the Supplier Name"
supname.SetFocus
Exit Sub
End If
If supaddr.Text = "" Then
MsgBox "Please enter the Supplier Address"
supaddr.SetFocus
Exit Sub
End If
'///////////////////////////////////
If rs.State = adStateOpen Then rs.Close
rs.Open " select Sup_Code from Supplier_Table where Sup_Code='" & Val(supcode.Text) & "'", cnn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
MsgBox " This supplier record is already present"
clear
Exit Sub
Else
'///////////////////////////////////////
If MsgBox("Are you sure to save this record ?", vbconfirmation + vbYesNo, "Shahbaz Oil Mill Pvt(Ltd)") = vbYes Then
If rs.State = adStateOpen Then rs.Close
rs.Open "Supplier_Table", cnn, adOpenDynamic, adLockOptimistic, adCmdTable
rs.AddNew
rs.Fields("Sup_Code") = supcode.Text
rs.Fields("Sup_Name") = supname.Text
rs.Fields("Sup_Addr") = supaddr.Text
rs.Fields("Sup_Ph#") = Val(supphno.Text)
clear
rs.MoveLast
supcode.Text = rs.Fields(0) + 1
rs.Update
rs.Close
supname.SetFocus
End If
End If
End Sub
Private Sub Command2_Click()
Set Form2.callingform = Me
Form2.Show vbModal
End Sub
Private Sub clear()
'supcode.Text = ""
supname.Text = ""
supaddr.Text = ""
supphno.Text = ""
'////////////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "Supplier_Table", cnn, adOpenStatic, adLockReadOnly, adCmdTable
If rs1.RecordCount = 0 Then
supcode.Text = 1
Else
rs1.MoveLast
supcode.Text = rs1.Fields(0) + 1
End If
supname.SetFocus
'////////////////////
End Sub
Private Sub Command3_Click()
clear
End Sub
Private Sub Command4_Click()
Unload Me
End Sub
Private Sub Form_Load()
Set cnn = New ADODB.Connection
cnn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=hussain"
Set rs = New ADODB.Recordset
rs.Open "Supplier_Table", cnn, adOpenStatic, adLockReadOnly, adCmdTable
If rs.RecordCount = 0 Then
supcode.Text = 1
Else
rs.MoveLast
supcode.Text = rs.Fields(0) + 1
End If
End Sub
Private Sub supaddr_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 44 Or KeyAscii = 95 Or KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii = 32 Or KeyAscii = 46) Then
KeyAscii = 0
' MsgBox "Please Enter integer Value"
End If
If KeyAscii = 13 Then
supaddr.SetFocus
End If
End Sub
Private Sub supcode_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Or KeyAscii = 13) Then
KeyAscii = 0
' MsgBox "Please Enter integer Value"
End If
If KeyAscii = 13 Then
supcode.SetFocus
End If
End Sub
Private Sub supname_KeyPress(KeyAscii As Integer)
If Not (KeyAscii = 8 Or KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii = 32 Or KeyAscii = 46) Then
KeyAscii = 0
'8=back space
''13=enter
'32=space bar
'46=point
End If
End Sub
Private Sub supphno_KeyPress(KeyAscii As Integer)
If Not (KeyAscii >= 48 And KeyAscii <= 57 Or KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii = 45) Then
KeyAscii = 0
'MsgBox "Please Enter integer Value"
End If
If KeyAscii = 13 Then
supphno.SetFocus
End If
End Sub
Private Sub update_Click()
If rs.State = adStateOpen Then rs.Close
rs.Open "select * from Supplier_Table where Sup_Code='" & Val(supcode.Text) & "'", cnn, adOpenDynamic, adLockOptimistic
If rs.BOF Or rs.EOF Then
MsgBox "First Select a Record From Search Button"
supname.SetFocus
Exit Sub
End If
If MsgBox("Are you sure to Update this record ?", vbconfirmation + vbYesNo, "Shahbaz Oil Mill Pvt(Ltd)") = vbYes Then
rs.Fields("Sup_Code") = supcode.Text
rs.Fields("Sup_Name") = supname.Text
rs.Fields("Sup_Addr") = supaddr.Text
rs.Fields("Sup_Ph#") = Val(supphno.Text)
rs.Update
clear
End If
clear
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -