|
-
Jun 19th, 2000, 01:06 PM
#1
Thread Starter
Member
Alright, I'm accessing a db though ADO. I have a textbox that sends a query search for whatever's in that textbox
Code:
Private Sub txtPhone_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
adoCustomer.RecordSource = "SELECT * FROM Customers" & _ "WHERE [Phone Number] = '" & txtPhone.Text & "'"
' txtFname.Text = adoCustomer.Recordset![First Name]
End If
End Sub
Now how would I display those fields in designated textboxes??
-
Jun 19th, 2000, 02:49 PM
#2
Hyperactive Member
is this what u wanted??????
Hi,
firstly,
what's the problem with the line
' txtFname.Text = adoCustomer.Recordset![First Name]
in ur code??? Is that not working????
coz as far as I can see....that should work. U'll probably have to repeat that line for each textbox.
Maybe u can also try using a control array (for the textbox), so that u can put that one line of code in a loop.
Hope this helps.
-
Jun 19th, 2000, 04:03 PM
#3
Frenzied Member
I don't use the ADO control ( I prefer to use the Recordset objects etc) but I think you'll need to do
ADOCustomer.Refresh
before you do
txtFname.Text = adoCustomer.Recordset![First Name]
'Buzby'
Visual Basic Developer
"I'm moving to Theory. Everything works there."
-
Jun 19th, 2000, 05:21 PM
#4
PowerPoster
Open Recordset
Hope this can help you. 
Code:
Option Explicit
Dim Conn As New ADODB.Connection
Dim Rs As New ADODB.Recordset
Dim xSQL As String
Private Sub Form_Load()
'Let take Biblio.mdb as an example
'Establish the Connection
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & App.Path & "\Biblio.mdb"
xSQL = "SELECT * FROM Authors WHERE Au_ID < 1000 ORDER BY Au_ID ASC;"
With Rs
.Open xSQL, Conn, adOpenKeyset, adLockPessimistic
While Not .EOF
Text1.Text = Text1.Text & .Fields(0) & Space(10) & .Fields(1) & vbCrLf
.MoveNext
Wend
End With
Rs.Close
Set Rs = Nothing
Conn.Close
Set Conn = Nothing
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|