Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Visual Basic > VB 6 Visual Basic 6 > VB Databases Basics
VB Databases Basics Beginning-level VB coding questions specific to using VB with databases. Issues not specific to database use will be redirected to other forums.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB Databases Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old July 10th, 2003, 10:18 PM
Authorized User
Join Date: Jun 2003
Posts: 32
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to arshad mahmood
Default How to search and display in textbox a specific ..

Hello Sir
I want to retreive a result by entring a key value in a
textbox and when i click button the reseult should beshown
on the bases of that key value which i have entered in the
text box.
For example:
I want to retreive the Author's name by entring the author_id
in a textbox.i want the author name should display in an
other textbox.
Is it posiable.
I hope u will help me.

arshad mahmood
arshad mahmood
Old July 11th, 2003, 08:07 AM
Authorized User
Join Date: Jun 2003
Posts: 91
Thanks: 0
Thanked 0 Times in 0 Posts

I use the recordset method so you can put something like this in your Click event....

Dim cxn As ADODB.Connection
Dim rst As ADODB.Recordset
Dim strSQL As String

Set cxn = New ADODB.Connection
Set rst = New ADODB.Recordset

'I use an Access DB if you use something else - like SQL -
'your connection will be a bit different
With cxn
.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
"add the absolute path to your data here"
End With

strSQL = _
"SELECT MyTable.strAuthorName" & _
"FROM MyTable " & _
"WHERE MyTable.intAuthorID= " & MyForm.TextBoxi & ";"

rst.Open strSQL, cxn, adOpenStatic, adLockReadOnly, adCmdText
txtResult.Text = rst!strAuthorName

Set rst = Nothing
Set cxn = Nothing

Hope this helps you out.....

Kenny Alligood

Similar Threads
Thread Thread Starter Forum Replies Last Post
Move cursor to specific textbox mona_upm84 Excel VBA 3 September 22nd, 2016 10:29 AM
Move cursor to specific textbox mona_upm84 Excel VBA 0 September 29th, 2008 09:35 PM
Search specific data from specific columns yogeshyl SQL Language 1 January 16th, 2008 11:12 AM
How do after i login it will display specific user PHP FAQs 0 July 20th, 2006 08:06 PM
How do you open a specific record from a search? Szimmer9 VB How-To 1 March 31st, 2006 12:57 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.