Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

VB, SQL choosing diffrent recordsets with combobox

Posted on 1998-09-05
4
Medium Priority
?
166 Views
Last Modified: 2010-04-30
Hi
Got a problem with a SQL statement..(I'am new to SQL)
I gotta access mdb
2 tables
In the first
Name  PersonID

In the second
PersonID Date Leg Waist Chest

I want to select a name in  a combobox
Then show in 4 textboxes the Date plus Leg
Waist and Chest measurement
Then rotate though that persons measurements
ONLY showing thats persons measurements.

I get stuck on the name all the time..I can show
the different measurement's but some of them show
the wrong person.

Any help or solutions..would be great...thanks
coffeman@swipnet.se
0
Comment
Question by:az1
  • 2
  • 2
4 Comments
 

Accepted Solution

by:
smohan earned 200 total points
ID: 1433181
Select A.*,B.*
from Table1 As A INNER JOIN Table2 As B
on A.PersonID = B.PersonID

use data control. Give the sql statement in the recordsource column instead of table name. Set the remaining property for textbox and combobox.

Try and tell me.
0
 

Author Comment

by:az1
ID: 1433182
Hi Smohan
I've tried the SQL Statement but can't get it work.
I'am still doing something wrong.

If it helps the two tables are called

Name         table name
-PersonID    primary key
-Name

Body         table name
-PersonID    primary key
-Chest
-Waist
-Legs

coffeeman@swipnet.se
0
 

Expert Comment

by:smohan
ID: 1433183
Add a data control to your form. I assume control name is data1.

Add a SQL statement to Datacontrol's 'RecordSource' property.
Specify the database path and database name.

Add a dbcombobox and text boxes.

set the following dbcombox properties
RowSource = Data1
ListField = specify your database field

In the dbcombobox click event add the following code

Private Sub DBCombo1_Click(Area As Integer)
If Data1.Recordset.RecordCount > 0 Then
    Data1.Recordset.Bookmark = DBCombo1.SelectedItem
End If
End Sub

Set the following text box property

Datasource= data1
datafield = specify the field

Now run the application. Select the diff. person name in the list, see whether textbox's value is changing accordingly or not?


0
 

Author Comment

by:az1
ID: 1433184
Thanks
For all the extra work as well...
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

971 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question