📄 frmnorthwind.frm
字号:
Height = 795
Left = 4350
TabIndex = 27
Top = 1650
Width = 3345
End
Begin VB.Label Label10
Caption = "Customer ID:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 26
Top = 960
Width = 1455
End
Begin VB.Label Fax
Caption = "Postal Code:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 21
Top = 4560
Width = 1455
End
Begin VB.Label Label9
Caption = "Phone"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 19
Top = 4200
Width = 1455
End
Begin VB.Label Label7
Caption = "Country:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 17
Top = 3840
Width = 1455
End
Begin VB.Label Label8
Caption = "Postal Code:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 15
Top = 3480
Width = 1455
End
Begin VB.Label txtRegionx
Caption = "Region"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 13
Top = 3120
Width = 1455
End
Begin VB.Label Label6
Caption = "City:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 11
Top = 2760
Width = 1455
End
Begin VB.Label Label5
Caption = "Address:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 9
Top = 2400
Width = 1455
End
Begin VB.Label Label4
Caption = "Contact Title:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 7
Top = 2040
Width = 1455
End
Begin VB.Label Label3
Caption = "Company Name:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 5
Top = 1320
Width = 1455
End
Begin VB.Label Label2
Caption = "Contact Name"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 3
Top = 1680
Width = 1455
End
Begin VB.Label Label1
Caption = "Filter:"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 255
Left = 120
TabIndex = 1
Top = 180
Width = 1455
End
End
Attribute VB_Name = "frmTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
' Make sure to create 5 procs for the Customer table in the northwind database
' called prc_ins_Customers, prc_upd_Customers, prc_sel_Customers and prc_del_Customers
' and one additional proc to allow for two types of Selects prc_sel_Customers_Output
' See attached file: Procs.sql
' To make both type of select procs run the procs 1st (using Proc-Blaster) with the
' option for Output parameters off, then run another select with it on and rename
' it prc_sel_Customers_Output
' You will also need to make an ODBC DSN called Northwind or alter the code in
' this project for the connection string
' All Procs and VB Data Access code generated with LockwoodTech Proc-Blaster 2
' http://www.lockwoodtech.com
Option Explicit
Dim objCustomer As clsCustomer
Private Sub cboCompanyName_Click()
Dim strSQL As String
Dim rs As New ADODB.Recordset
Dim lngRetVal As Long
If cboCompanyName.ListIndex = -1 Then Exit Sub
' Creating a new customer object (in the process destroying any existing one)
Set objCustomer = New clsCustomer
lngRetVal = objCustomer.Find(RTrim(cboCompanyName))
' load up the form with the object's data
With objCustomer
txtCompanyName = .CompanyName
txtContactName = IIf(IsNull(.ContactName), "", .ContactName)
txtContactTitle = IIf(IsNull(.ContactTitle), "", .ContactTitle)
txtAddress = IIf(IsNull(.Address), "", .Address)
txtCity = IIf(IsNull(.City), "", .City)
txtRegion = IIf(IsNull(.Region), "", .Region)
txtPostalCode = IIf(IsNull(.PostalCode), "", .PostalCode)
txtCountry = IIf(IsNull(.Country), "", .Country)
txtPhone = IIf(IsNull(.Phone), "", .Phone)
txtFax = IIf(IsNull(.Fax), "", .Fax)
txtCustomerID = .CustomerID
End With
End Sub
Private Sub cmdDelete_Click()
Dim lngRetVal As Long
lngRetVal = objCustomer.Delete
If lngRetVal = 0 Then
MsgBox "Operation Succeeded", vbInformation, "Results"
Else
MsgBox "Operation Failed", vbCritical, "Results"
Exit Sub
End If
Call Clear_Controls
Call requery_list
End Sub
Private Sub cmdNew_Click()
Set objCustomer = Nothing ' destroy old object
Set objCustomer = New clsCustomer ' create new object
Call Clear_Controls
cboCompanyName.ListIndex = -1
End Sub
Private Sub cmdSave_Click()
Dim lngRetVal As Long
' load up the object's properties with the user supplied data
With objCustomer
.CompanyName = txtCompanyName
.ContactName = txtContactName
.ContactTitle = txtContactTitle
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -