📄 buyer registration.frm
字号:
Strikethrough = 0 'False
EndProperty
ForeColor = &H00000000&
Height = 255
Left = 240
TabIndex = 14
Top = 960
Width = 1815
End
Begin VB.Label Label3
BackStyle = 0 'Transparent
Caption = "Customer Address"
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 = 240
TabIndex = 13
Top = 1440
Width = 2055
End
Begin VB.Label Label4
BackStyle = 0 'Transparent
Caption = "Customer Phone No"
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 = 240
TabIndex = 12
Top = 1920
Width = 2175
End
End
Begin VB.TextBox supname
Appearance = 0 'Flat
Height = 285
Left = 2400
TabIndex = 10
Top = 2280
Width = 2175
End
Begin VB.TextBox supcode
Appearance = 0 'Flat
Height = 285
Left = 2400
Locked = -1 'True
TabIndex = 9
Top = 1920
Width = 2175
End
Begin VB.Image Image3
Height = 675
Left = 6210
Picture = "Buyer Registration.frx":0000
Top = 5205
Width = 690
End
Begin VB.Label Label6
BackColor = &H80000013&
Height = 5535
Left = 6480
TabIndex = 19
Top = 0
Width = 255
End
Begin VB.Image Image2
Height = 825
Left = -1000
Picture = "Buyer Registration.frx":18DE
Top = 5760
Width = 7545
End
Begin VB.Image Image1
Height = 6480
Left = 6480
Picture = "Buyer Registration.frx":15DF8
Top = 0
Width = 1440
End
Begin VB.Label Label5
BackStyle = 0 'Transparent
Caption = "Customer Registration"
BeginProperty Font
Name = "Times New Roman"
Size = 24
Charset = 0
Weight = 700
Underline = -1 'True
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 735
Left = 960
TabIndex = 17
Top = 480
Width = 4815
End
End
Attribute VB_Name = "Form20"
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 buyeraddr_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
End Sub
Private Sub buyername_KeyPress(KeyAscii As Integer)
If Not (KeyAscii = 8 Or KeyAscii = 13 Or KeyAscii >= 65 And KeyAscii <= 90 Or KeyAscii >= 97 And KeyAscii <= 122 Or KeyAscii = 32 Or KeyAscii = 46) Then
KeyAscii = 0
End If
End Sub
Private Sub buyerphno_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
End Sub
Private Sub clear_Click()
buyername.Text = ""
buyeraddr.Text = ""
buyerphno.Text = ""
'////////////////////////
If rs1.State = adStateOpen Then rs1.Close
rs1.Open "Customer_Table", cnn, adOpenStatic, adLockReadOnly, adCmdTable
If rs1.RecordCount = 0 Then
buyercode.Text = 1
Else
rs1.MoveLast
buyercode.Text = rs1.Fields(0) + 1
End If
'/////////////////////////
buyername.SetFocus
End Sub
Private Sub Command1_Click()
If rs.State = adStateOpen Then
rs.Close
End If
If buyercode.Text = "" Then
MsgBox "Please enter the Customer Code"
buyercode.SetFocus
Exit Sub
End If
If buyername.Text = "" Then
MsgBox "Please enter the Customer Name"
buyername.SetFocus
Exit Sub
End If
If buyeraddr.Text = "" Then
MsgBox "Please enter the Customer Address"
buyeraddr.SetFocus
Exit Sub
End If
'//////////////////////////////
If rs.State = adStateOpen Then rs.Close
rs.Open " select Cust_Id from Customer_Table where Cust_Id='" & Val(buyercode.Text) & "'", cnn, adOpenStatic, adLockReadOnly
If rs.RecordCount > 0 Then
MsgBox " This customer record is already present"
clear_Click
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 "Customer_Table", cnn, adOpenDynamic, adLockOptimistic, adCmdTable
rs.AddNew
rs.Fields("Cust_Id") = buyercode.Text
rs.Fields("Cust_Name") = buyername.Text
rs.Fields("Cust_Addr") = buyeraddr.Text
rs.Fields("Cust_Ph#") = Val(buyerphno.Text)
clear_Click
rs.MoveLast
buyercode.Text = rs.Fields(0) + 1
rs.Update
buyername.SetFocus
End If
End If
End Sub
Private Sub Command2_Click()
Set Form21.callingform = Me
Form21.Show vbModal
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 "Customer_Table", cnn, adOpenStatic, adLockReadOnly, adCmdTable
If rs.RecordCount = 0 Then
buyercode.Text = 1
Else
rs.MoveLast
buyercode.Text = rs.Fields(0) + 1
End If
End Sub
Private Sub update_Click()
If rs.State = adStateOpen Then rs.Close
rs.Open "select * from Customer_Table where Cust_Id='" & Val(buyercode.Text) & "'", cnn, adOpenDynamic, adLockOptimistic
If rs.BOF Or rs.EOF Then
MsgBox "First Select a Record From Search Button"
buyername.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("Cust_Id") = buyercode.Text
rs.Fields("Cust_Name") = buyername.Text
rs.Fields("Cust_Addr") = buyeraddr.Text
rs.Fields("Cust_Ph#") = Val(buyerphno.Text)
rs.Update
clear_Click
End If
clear_Click
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -