Click to See Complete Forum and Search --> : Adding fields to textboxes
AndyB
Nov 23rd, 2000, 10:56 PM
I have two tables called Riders and Titles.
I have the connection and the SQL statement right.
Can anybody please tell me how to do this,
Set txtRegional.dataSource = ?
txtRegional.dDataField = "Regional"
I want to get the field Regional from the Titles Table.
who's Primary Key is in the Riders Table.
Hope this makes sense. Thank for any help.
davidrobin
Nov 24th, 2000, 07:06 AM
The way you do this would depend on the way you have set up your current SQL query.
If I understand right you have set up a connection to your database and specified an SQL query which populates a recordset with records from the Riders table. You now want to get the field Regional from the Titles Table. You can have a second recordset that queries the Titles table for the Regional field using the primary key held in the Riders Table in the where clause.
SELECT Regional FROM Titles WHERE Titles.key = Riders.key
This would give you the Regional field which you could assign to the text of the textbox. To ensure the text changed you should use the on move method of the recordset holding the Riders table data.
Another way to do all this would be to have a sinle SQL query that joins the two tables together, therefore you only need one recordset. I would have thought this would be much better.
Set txtRegional.dataSource= <name of recordset>
Hope I have understood correctly.
Feel free to ask me more questions if need be.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.