473,378 Members | 1,138 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

filtering form by combo box not really working

Hi folks.

My database project has the following:

--------------------------------------------------------------------------------
tables:
Member: MemName, MemNo [PK], MemType, CourseFaculty
History: contains all of the above

queries:
qryHistory: based on History

forms:
frmHistory: based on qryHistory. MemNo, MemType and CourseFaculty is
not Enabled and not Visible. Also contains a combo box "cboName", and
a label "lblTitle".
--------------------------------------------------------------------------------

frmHistory is used to display the borrowing habits of members (i.e.
which member borrowed what particular book at what date, etc.).

cboName is used to filter frmHistory by a member's name (for example,
if I choose "Aravind" from the list, frmHistory will be filtered to
display my borrowing habits). When I choose a name from the combo box
list, lblTitle will display the details of that particular member
(continuing from the example above, lblTitle will display my name,
I.D., MemType, and CourseFaculty). I use a macro (macro_cboName) to do
this:

--------------------------------------------------------------------------------
Action: OpenForm
Form Name: frmHistory
Where Condition: [MemName]=[Forms]![frmHistory].[cboName]

Action: SetValue
Item: [Forms]![frmHistory].[lblTitle].[Caption]
Expression: [Forms]![frmHistory].[cboName] & ", " &
[Forms]![frmHistory].[MemNo] & ", " & [Forms]![frmHistory].[MemType] &
", " & [Forms]![frmHistory].[CourseFaculty]

Action: SetValue
Item: [Forms]![frmHistory]![cboName]
Expression: Null
--------------------------------------------------------------------------------

The problem is that, if I choose a member name who doesn't have an
entry in History (and hence in qryHistory and frmHistory), lblTitle
will only display that member's name, whereas I want it to display
the details of that member (as in the examples above). How do I do
that? BTW, I'm using Access '97. Thank you.
Nov 13 '05 #1
1 1909
See comments inline...

On 8 Jul 2004 01:21:19 -0700, so**********@hotmail.com (Aravind)
wrote:
Hi folks.

My database project has the following:

--------------------------------------------------------------------------------
tables:
Member: MemName, MemNo [PK], MemType, CourseFaculty
History: contains all of the above This doesn't look normalized. The only common field between the two
tables should be MemNo. MemNo the PK in the Member table should only
be the FK in the History table. Don't store the same information in
more than 1 place. This could be the cause of your ambiguity.

queries:
qryHistory: based on History This should be based on Member *and* History inner joined on MemNo.

forms:
frmHistory: based on qryHistory. MemNo, MemType and CourseFaculty is
not Enabled and not Visible. Also contains a combo box "cboName", and
a label "lblTitle".
--------------------------------------------------------------------------------

frmHistory is used to display the borrowing habits of members (i.e.
which member borrowed what particular book at what date, etc.).
This would be best as a form/subform. The parent form would hold the
Member info and the subform would hold the History info - borrowing,
etc.
cboName is used to filter frmHistory by a member's name (for example,
if I choose "Aravind" from the list, frmHistory will be filtered to
display my borrowing habits). When I choose a name from the combo box
list, lblTitle will display the details of that particular member
(continuing from the example above, lblTitle will display my name,
I.D., MemType, and CourseFaculty). I use a macro (macro_cboName) to do
this:
I would base the combo on a query of Member:
SELECT MemNo, MemName FROM Member

Set the columns to 2 the first would have a width of 0 (so you can't
see it) and the second to whatever you need. This way the MemNo is the
reference for the recordset. (In case you have more than one member
with the same name)

Use the combo box as the criteria of the form's RecordSource.
I don't do macros so I won't offer any suggestions; but I would use
the cboName AfterUpdate event to requery the form which would bring up
the Member info along with the History info in the subform.
--------------------------------------------------------------------------------
Action: OpenForm
Form Name: frmHistory
Where Condition: [MemName]=[Forms]![frmHistory].[cboName]

Action: SetValue
Item: [Forms]![frmHistory].[lblTitle].[Caption]
Expression: [Forms]![frmHistory].[cboName] & ", " &
[Forms]![frmHistory].[MemNo] & ", " & [Forms]![frmHistory].[MemType] &
", " & [Forms]![frmHistory].[CourseFaculty]

Action: SetValue
Item: [Forms]![frmHistory]![cboName]
Expression: Null
--------------------------------------------------------------------------------

The problem is that, if I choose a member name who doesn't have an
entry in History (and hence in qryHistory and frmHistory), lblTitle
will only display that member's name, whereas I want it to display
the details of that member (as in the examples above). How do I do
that? BTW, I'm using Access '97. Thank you.

I think approaching it along the lines mentioned above will solve this
problem along with other future problems.
- Jim
Nov 13 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
3
by: Jason | last post by:
I am trying to filter records in a primary form based on records in related tables. The data in the related tables is being displayed in the primary form through subforms. To be more specific, I...
1
by: Alex | last post by:
Acc97. I have a form which within a subform records machine down time. I have a total of 8 machines. (1-2-3 ect.) What I have been doing is using a combo box linked to the record table to...
2
by: Sean | last post by:
Greetings all, I am attempting to make a form that will filter through several tables that (I believe) have refretial integrity. I am pulling data from several tables into the form and i would...
1
by: MLH | last post by:
I have a form (xxxxxxxxxxxxxx) with a combo-box control (yyyyyyyyyyyyyy). The rowsource property for that combo box is as follows: SELECT DISTINCTROW ., . FROM ; The SQL for qryVehicleList...
1
by: hackerslacker | last post by:
I have an ordering form that use two combo boxes to filter down the records of a Products table. This worked fine with the after_Update of the first filtering the records and creating the...
8
by: Ragbrai | last post by:
Howdy All, I have a query that is used for filtering results to be used in a combo box. The query needs to test fields from both a table and then unbound text boxes on the form that also contains...
2
by: Dev1 | last post by:
All- I'm new to this forum and i've been working with acces for about 2 days now. I have a form in which I have two combo boxes and depending on what is selected on the first dropdown the second...
3
by: flymo | last post by:
Hello All, I've bee trying out access 2007 and have a weird issue and would like to see if I'm issing something really basic. I have a form based on a query, I create a combo to look for records...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.