frmPublishers.frm

 VERSION 5.00
Begin VB.Form frmPublishers
   BorderStyle     =   3  'Fixed Dialog
   Caption         =   "Publishers Form"
   ClientHeight    =   4770
   ClientLeft      =   45
   ClientTop       =   330
   ClientWidth     =   6315
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MDIChild        =   -1  'True
   MinButton       =   0   'False
   ScaleHeight     =   4770
   ScaleWidth      =   6315
   ShowInTaskbar   =   0   'False
   Begin VB.CommandButton Command3
      Caption         =   "Show Titles"
      Height          =   375
      Left            =   4560
      TabIndex        =   22
      Top             =   4080
      Width           =   1215
   End
   Begin VB.CommandButton Command1
      Caption         =   "Find"
      Height          =   375
      Left            =   480
      TabIndex        =   21
      Top             =   4080
      Width           =   855
   End
   Begin VB.CommandButton Command2
      Caption         =   "Close"
      Height          =   375
      Left            =   1440
      TabIndex        =   20
      Top             =   4080
      Width           =   855
   End
   Begin VB.TextBox Text10
      Height          =   375
      Left            =   1800
      TabIndex        =   19
      Top             =   3360
      Width           =   3975
   End
   Begin VB.TextBox Text9
      Height          =   375
      Left            =   4560
      TabIndex        =   17
      Top             =   2880
      Width           =   1215
   End
   Begin VB.TextBox Text8
      Height          =   375
      Left            =   1800
      TabIndex        =   15
      Top             =   2880
      Width           =   1215
   End
   Begin VB.TextBox Text7
      Height          =   375
      Left            =   1800
      TabIndex        =   13
      Top             =   2400
      Width           =   1215
   End
   Begin VB.TextBox Text6
      Height          =   375
      Left            =   4560
      TabIndex        =   11
      Top             =   1920
      Width           =   1215
   End
   Begin VB.TextBox Text5
      Height          =   375
      Left            =   1800
      TabIndex        =   9
      Top             =   1920
      Width           =   1215
   End
   Begin VB.TextBox Text4
      Height          =   375
      Left            =   1800
      TabIndex        =   7
      Top             =   1440
      Width           =   3975
   End
   Begin VB.TextBox Text3
      Height          =   375
      Left            =   1800
      TabIndex        =   5
      Top             =   960
      Width           =   2655
   End
   Begin VB.TextBox Text2
      Height          =   375
      Left            =   4560
      TabIndex        =   3
      Top             =   480
      Width           =   1215
   End
   Begin VB.TextBox Text1
      Height          =   375
      Left            =   1800
      TabIndex        =   1
      Top             =   480
      Width           =   1215
   End
   Begin VB.Label Label10
      Caption         =   "Comments"
      Height          =   255
      Left            =   480
      TabIndex        =   18
      Top             =   3360
      Width           =   1215
   End
   Begin VB.Label Label9
      Caption         =   "Fax"
      Height          =   255
      Left            =   3240
      TabIndex        =   16
      Top             =   2880
      Width           =   1215
   End
   Begin VB.Label Label8
      Caption         =   "Telephone"
      Height          =   255
      Left            =   480
      TabIndex        =   14
      Top             =   2880
      Width           =   1215
   End
   Begin VB.Label Label7
      Caption         =   "Zip"
      Height          =   255
      Left            =   480
      TabIndex        =   12
      Top             =   2400
      Width           =   1215
   End
   Begin VB.Label Label6
      Caption         =   "State"
      Height          =   255
      Left            =   3240
      TabIndex        =   10
      Top             =   1920
      Width           =   1215
   End
   Begin VB.Label Label5
      Caption         =   "City"
      Height          =   255
      Left            =   480
      TabIndex        =   8
      Top             =   1920
      Width           =   1215
   End
   Begin VB.Label Label4
      Caption         =   "Address"
      Height          =   255
      Left            =   480
      TabIndex        =   6
      Top             =   1440
      Width           =   1215
   End
   Begin VB.Label Label3
      Caption         =   "Company Name"
      Height          =   255
      Left            =   480
      TabIndex        =   4
      Top             =   960
      Width           =   1215
   End
   Begin VB.Label Label2
      Caption         =   "Name"
      Height          =   255
      Left            =   3240
      TabIndex        =   2
      Top             =   480
      Width           =   1215
   End
   Begin VB.Label Label1
      Caption         =   "Publisher ID"
      Height          =   255
      Left            =   480
      TabIndex        =   0
      Top             =   480
      Width           =   1215
   End
End
Attribute VB_Name = "frmPublishers"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Public Sub Command1_Click()

If Text1.Text = "" Then MsgBox "Enter Publisher ID first", vbInformation: Exit Sub
Dim CN As New ADODB.Connection
Dim RS As New ADODB.Recordset

CN.Open Conn
RS.Open "Select * From Publishers Where PubID=" & Text1.Text, CN

If Not RS.EOF Then

On Error GoTo Er1:
Text1.Text = RS.Fields(0)
Text2.Text = RS.Fields(1)
Text3.Text = RS.Fields(2)
Text4.Text = RS.Fields(3)
Text5.Text = RS.Fields(4)
Text6.Text = RS.Fields(5)
Text7.Text = RS.Fields(6)
Text8.Text = RS.Fields(7)
Text9.Text = RS.Fields(8)
Text10.Text = RS.Fields(9)
Command3_Click



Else

MsgBox "Publisher not found", vbInformation

End If

Set RS = Nothing
Set CN = Nothing

Exit Sub

Er1:
If Err.Number = 94 Then
Resume Next
Else
MsgBox "Error number = " & Err.Number & vbCrLf & Err.Description, vbCritical
End If


End Sub

Private Sub Command2_Click()
Unload Me
End Sub

Private Sub Command3_Click()
frmPublisherTitle.Text1.Text = Text1.Text
frmPublisherTitle.Text2.Text = Text2.Text
frmPublisherTitle.Command1_Click

End Sub

Project Homepage: