473,411 Members | 2,019 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,411 software developers and data experts.

Select columns based on user input range

35
Hi,

I have a table in access which has the following columns:

ID Pname Aug10 Sep10 Oct 10 Nov10 Dec10

and more column for the months until the year 2015.

I have a form which has two comboboxes that lets the user selects the start MMMYY and the end MMMYY. I am not able to find a way to write a query that selects the correct columns based on the user's input.

For example if the user selects Aug10 and Nov11, the result should be the data and columns between these two selections.

Aug10, Sep10, Oct10 ........ Nov11 columns should be selected.

Any suggestions ?

Thanks.
Aug 5 '11 #1
5 2928
Stewart Ross
2,545 Expert Mod 2GB
Sorry, but your current table design is not even in first normal form - you have the year-month repeated as a separate column (a repeating group). You will not be able to design queries to retrieve such data properly without normalising your data first. You can calculate year-month totals using a crosstab query for instance - but in this case you would just be querying on a transaction date in your table. You should NEVER be storing totals under month headings as attributes of your table.

We have an article about database normalisation and table structures which gives an excellent introduction to this topic.

What you have at present is what you may well have had if you were working in Excel - but Excel is at heart a powerful calculating system for flat-form tables, not a relational database.

-Stewart
Aug 5 '11 #2
MeeMee
35
ya i know that it is not normalized, problem is they want me to use the excel sheet and import in access and not make changes, i knew it is impossible to do but thought of asking if there are other indirect ways , thanks anyway.
Aug 5 '11 #3
Mihail
759 512MB
"They", 100%, are not programers. So, "they" should never say HOW TO solve a problem. If they know "how to" why they don't accomplish the task ? On the other hand, YOU are programmer. So, you can explain that you can solve the problem BUT in your own way. Or... leave them and looking for a clever owner.

I know: this isn't an Access answer. But, I encountered the same problem as MeeMee a few years ago. And, after I try different amiable ways to solve the situation, I must leave my job.

Good luck, MeeMee !
And sorry again to the forum members and visitors.
Aug 6 '11 #4
NeoPa
32,556 Expert Mod 16PB
Why not consider separating the data out into normalised form after you import the data from Excel?
Aug 6 '11 #5
Mihail
759 512MB
Sorry again for my previous post. It was one of my bigger frustrations.

I think NeoPa suggest should work. But I think (again) that is better to manage dates using Excel tools. Create new sheets in Excel. In this sheets arrange your dates in a normalised tables (using Excel tools) then import this tables in Access.

Related:
Provide more information about the whole task. Maybe someone have better ideas.
Aug 6 '11 #6

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

Similar topics

8
by: hokiegal99 | last post by:
I don't understand how to use a loop to keep track of user input. Could someone show me how to do what the program below does with a loop? Thnaks! ---------------------------- #Write a...
3
by: N?ant Humain | last post by:
I have just begun learning Python so that I can write a simple script to make modification of a file used by another Python script easier. This file is basically a list of regular expressions. What...
2
by: reneeccwest | last post by:
Different user input boxes are automatically populated based on a value of the dropdown box. Can anyone help me on that?
0
by: Michael | last post by:
Hi All, I am working on my intranet reporting web site, by use of IIS5 + Office2000 +SQL2000. Currently, the first step, I show user an ASP web-interface to collect user input, keyword...
4
by: joesin | last post by:
I recently found a vulnerability on my website that allowed sql injection. I have been trying to write some code that would clean user data but have been running into problems. The validation still...
2
by: wertqt | last post by:
hi there, im having a slight problem in matching the user input(textbox's text) with the values in one of the columns from a MS Access database. Im using C#.NET. The situation is this : My...
1
by: bob1660 | last post by:
I am new to PHP and MYSQL. I have a Database table with 4 field. FirstName, LastName, DateofBirth and MemberNumber. I would like to have a form where a user can fill in the FirstName, LastName and...
4
by: bob1660 | last post by:
I am new to PHP and MYSQL. I have a Database table with 4 field. FirstName, LastName, DateofBirth and MemberNumber. I would like to have a form where a user can fill in the FirstName, LastName and...
12
by: Tarique | last post by:
I have tried to restrict the no. of columns in a line oriented user input.Can anyone please point out potential flaws in this method? btw.. 1.I have not used dynamic memory allocation because...
4
by: Manikrag | last post by:
Hi Team, Is it possible to sort select query based on input string? I am looking for somthing like: select TOP 20 PREFERRED_NAME from FRS_TABLE where Lower(PREFERRED_NAME) like...
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.