Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

VB, SQL choosing diffrent recordsets with combobox

Posted on 1998-09-05
4
Medium Priority
?
159 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

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…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
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…
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…
Suggested Courses

722 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