Hi im currently having a problem with taking data from a field in a database and then using it within the form, when supplied with a telephone number by inputting in
to a text box, the number needs to be checked against the database and then if a record matches the telephone number the Name in the record shoudl be inserted into another text box.
I am using visual basic 6 and microsoft access 2000
At the moment i am getting an error of "the connection cannot be used to perform this operation"
Dim CON As Connection Dim rs As New Recordset Dim SQLname As String Private Sub cmd_details_Click() rs.Open "Select * from customer, CON, adOpenKeyset, adLockOptimistic," SQLname = "Select name from Customer where telephone='" & (txtphone.Text) txtname.Text = SQLname End Sub Private Sub form_initialize() Set CON = New ADODB.Connection 'set the database connection CON.Open "Provider=Microsoft.jet.oledb.4.0; Data Source=" & App.Path & "\test.mdb" 'connection string to the database End Sub
thanks in advance