with VB 6 & Access as database, how do i display a corresponding record from a combo to textbox?
pratheep r
2008-06-23 21:31:49 UTC
I ve used a datacombo box to display set of information, i would like the text box that displays a different field but corresponding record. does anybody have an answer for this?
Three answers:
AllanHP
2008-06-23 21:44:47 UTC
I assume your using adodc since you hava a datacombo, so just add a textbox control and set datasource to your adodc and datamember to the field you like to use, selecting data from datacombo causes the pointer in your recordset to move to that particular record so your textbox will automatically update itself after all this is a bounded style database connection
you might wanna include this in your datacombo click event
Private Sub DataCombo1_Click(Area As Integer)
Adodc1.Refresh
End Sub
update:
its because your table name contains "-", try enclosing the table name with [] ex. "[non-technical]" and next time avoid using special characters when naming objects in your database
♠ jhun ♠
2008-06-23 22:16:10 UTC
Why won't use alternative.
Project - Reference
check DAO 3.5 higher
Option Explicit
Dim db as Database
Dim rs as Recordset
Sub Form_Load()
Set db = DBEngine.OpenDatabase("database.mdb")
Set rs = db.OpenRecordSet("TableName")
Text1.Text = rs.fields("fieldName")
End Sub
Private Sub cmdNext_Click()
rs.moveNext
End Sub
?
2016-10-24 06:42:55 UTC
To best of my recognize-how, having ODBC driving force for MS get admission to could be solid sufficient, both even as progression besides as end person region. attempt some r&d code on device the position there is purely get admission to ODBC driving force is put in, no longer complete get admission to software.
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.