halu,seahck said:im a newbie and i have some question.
how to lookup a table from a form. during form_load i want to lookup a field from a table to fill inside 1 of the textbox in the form. anyone know it? thank.........
Dim objConnection As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=\somepath\mydb.mdb;User Id=admin;Password=;")
Dim strSQL As String
strSQL = "SELECT Address FROM mydatabase WHERE Name='" & txtName.Text & "'"
Dim cmd As OleDbCommand = New OleDbCommand(strSQL, cnn)
Try
objConnection.Open()
txtAddress.Text = cmd.ExecuteScalar
Finally
Try
objConnection.Close()
Catch : End Try
End Try