Solved

VB, SQL choosing diffrent recordsets with combobox

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
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…

860 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