Solved

VB, SQL choosing diffrent recordsets with combobox

Posted on 1998-09-05
4
146 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 50 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
You can of course define an array to hold data that is of a particular type like an array of Strings to hold customer names or an array of Doubles to hold customer sales, but what do you do if you want to coordinate that data? This article describes…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
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…

867 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

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now