Schavda,
Code:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Private Sub Command1_Click()
Set rs = cn.Execute("Select * FROM Employees WHERE EmployeeID=" & CInt(Val(txtID.Text)))
'fill the box
txtFirstName.Text = rs!FirstName
txtLastName.Text = rs!LastName
txtTitle.Text = rs!Title
txtBirthDate.Text = rs!BirthDate
'expand the form
Me.Height = 1788
End Sub
Private Sub Form_Load()
'connection to Northwind database on local machine
Set cn = New ADODB.Connection
With cn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.3.51;Persist Security Info=False;Data Source=C:\Program Files\Microsoft Visual Studio\VB98\Nwind.mdb"
.Open
End With
'set the form size
Me.Width = 3648
Me.Height = 828
End Sub
Regards,
TheBao