473,394 Members | 1,794 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,394 software developers and data experts.

Dropdown Report Menu on a form

68 64KB
Hi,
I have a database with school information. On the reporting form, I have a dropdown combo that contains list of teachers by schools. The problem I am having is, when I select the dropdown, instead of listing individual school, it list a school five times, for an example, meaning there are five teachers at that school.
Is is possible to have my dropdown list just the school even if it has more than one teacher?

This is what I have so far: ADezii helped me with this some time ago.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Command84_Click()
  2.  
  3. If Me![cboSchoolCode] = "--select--" Then Exit Sub
  4.  
  5. DoCmd.OpenReport "rptInServiceIndividualSchoolAndTeachersInformation", acViewReport, , "lngSchoolCode = '" & Me.cboSchoolCode & "'"
  6.  
  7. cboSchoolCode = "--select--"
  8.  
  9. End Sub
Sep 20 '12 #1

✓ answered by Seth Schrock

Did you try the SELECT DISTINCT in there? What were the results?

5 1689
Seth Schrock
2,965 Expert 2GB
If I'm understanding you correctly, only the school is listed, but each school is being listed once for each teacher at the school. This means that the row source needs changed. Usually, you would have a table of schools separate from the table of teachers, in which case you would need the row source to query the schools table. If for some reason you don't have the separate schools table, then you would query your table for DISTINCT records. For example:

Expand|Select|Wrap|Line Numbers
  1. SELECT DISTINCT [School]
  2. FROM [table]
  3. WHERE [if needed]
If you need further help on this, post the code that is in your row source. If it is the name of a query, then open that query in SQL view and post that code. Make sure to use code tags (the button that says <code/>)
Sep 20 '12 #2
Stoic
68 64KB
Thanks for the add.
This is what I have:

Expand|Select|Wrap|Line Numbers
  1. SELECT 
  2.    tblTeachersProfile.lngSchoolCode,
  3.    tblTeachersProfile.strSchoolName 
  4. FROM tblTeachersProfile 
  5. ORDER BY tblTeachersProfile.strSchoolName;
Sep 20 '12 #3
Seth Schrock
2,965 Expert 2GB
Did you try the SELECT DISTINCT in there? What were the results?
Sep 20 '12 #4
Stoic
68 64KB
Thanks Seth,
It works just as I wanted.
Sep 20 '12 #5
Seth Schrock
2,965 Expert 2GB
Not a problem. Please click on the Choose as Best Answer.
Sep 20 '12 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Dalan | last post by:
I'm developing a report selection form and one of the elements of design is providing Date from/to text boxes. I have a Table that contains all of the information regarding the reports and did...
0
by: Bill Nguyen | last post by:
Is there any CR report menu/templates for ASP.NET out there that I can purchase to use with various existing CR reports in our company? All I need is an application that allows you to add existing...
1
by: Dino Buljubasic | last post by:
Hi, I have a toolbar with several buttons on it, one of which is set up to be as a DropDown button. I also have a context menu with menu items assigend to it so when I click that button, my...
2
by: SDorval | last post by:
I'm a newbie and I was wondering how to place a drop down selection menu in a form. I'm making a new site and It's very important, give me feedback through this site or through email at...
0
by: venhari | last post by:
Hi Friends, I have 2 Forms one is ListMenu.aspx and other one is ModifyMenu.aspx. Listmenu.aspx is to diaply all the menus of Tree View Control in Data Grid. like First Column is TabName,...
1
by: FreeLunch | last post by:
I have a database in Access 2003 that was originally developed using XP. When the database is opened on a Vista computer, the font size in a report or form is bigger. (The reports/forms don't...
9
by: jmar93 | last post by:
I am new to Access and was hoping someone could help me with a question. On a report or form you can place "=Date()" in a text box to display the current date, is there a way to have it display the...
13
by: jmartmem | last post by:
Greetings, I am using Dreamweaver CS3 to design an ASP page that contains a Record Insertion Form. Within this form are two list/menu form fields that I would like to "synchronize". In other...
5
by: jerry101 | last post by:
Hi, I've been working on a horizontal drop down menu today, and I can get it to display perfectly in everything bar IE6. Basically instead of them lining up horizontally, they line up...
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.