Solved

VB, SQL choosing diffrent recordsets with combobox

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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

708 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

19 Experts available now in Live!

Get 1:1 Help Now