Microsoft Access - Changing the recordsource or dynamically hiding columns of a query

Asked By Jason on 26-Jun-12 01:34 PM
Earn up to 10 extra points for answering this tough question.
So my problem is that I have a query that has fields based on what month we are in.  For instance, since it's June right now I would need 6 fields in this query.  When it turns to July, I would want 7 fields to show.  I'm not sure how to accomplish this however.  I should mention this query will be used in a graph in a report.  My ideas so far have to either hide the fields based on what month it is in vba or to change the recordsource of the graph in vba and make 12 queries.  Anyone have any other ideas or know how to make the ideas I have become possible?
wally eye replied to Jason on 26-Jun-12 06:34 PM
You could build the query in VBA, it would be a bit slower. 

Would a cross-tab query work?  Just put your selection criteria in and use the month for column headers.
Jason replied to wally eye on 27-Jun-12 10:09 AM
No unfortunately the dates span the entire year.  So a crosstab query would show the full year.
Pat Hartman replied to Jason on 28-Jun-12 08:29 PM
Selection criteria would limit the rows selected so if your data is normalized, the crosstab solution will work.  It sounds like you have 12 columns in the same row rather than 12 rows so that means more work as is usual for a non-normalized schema.  You either need 12 queries and decide which to run based on the month or you build the SQL string with VBA depending on the month.
help
Good Morning, I have a database that has 2 in the first subform both these forms use the same table tblServiceInfo. I am using Access 2007. Does anyone have a clue on how to do this? Thank you in advance. Change the query of the RecordSource of the first subform so that its selection criteria refers to th current record in on the same main form. You could then use the Master / Child link fields and Access would take care of syncing the two forms. Also, note that this will not work at the same time. You cannot refer to a form that is not open. keywords: Access 2007, Microsoft Access, database, subform description: Access 2007 Good Morning, I have a database that has 2
I am using DLookup in a subform. I have you entered as the event property setting produced the following error: A problem occurred while Microsoft Access was communicating with the OLE server or ActiveX Control". Anybody able to help? I am using this in a network environment, but do not have access as administrator, if that makes a difference. Thanks!! Karen If you are looking to display in the combobox but store the key value, it might be better to setup the recordsource in a two column combobox, column 1 with a width of 0, column 2 with 1 would be your key value, column 2 the description. Bound Column = 1. keywords: Control, Microsoft Access, DLookup, Update, description, part number, combo box description: Access and Dlookup I am using
Hi. I'm only an access novice, I'm using the ColumnHistory function in Access 2007: = ColumnHistory([RecordSource], "Comments", "[ID] = " & Nz([ID], 0)) and would like to show in a form and on out the last comment rather than all version history? Thank you in advance. V keywords: Access 2007, date, Microsoft Access, report, Copy description: ColumnHistory Hi. I'm only an access novice, I'm using the
I am trying to pull the highest, lowest and and [end] into the parameters but the second set still pops up. Reports run their RecordSource query twice if you use page x of y since the report needs to calculate will just get the date from the form and not prompt you. keywords: exception, date, Microsoft Access, report, Max, Min description: Access Report I am trying to pull the highest, lowest and average from a report I
I have a report that calculates the precentage of the top of my head here. Another option may be to build your main reports recordsource to include the training totals, but that may slow down your loading time. keywords: Microsoft Access, Percentage, report, training description: Duplicating Calculated Fields in Access Reports I have a report that calculates the precentage of training completed against what is
Hello everyone, I have a simple report in Access that lists an estimate number numerous times (in this example, 5 times). Next to each please expand your request with more details. Note, BETWEEN needs to be applied as per Access Syntax in the Query. Hope this assists. Your form needs two unbound date fields and ways to do this. Method 1. Create a query to use as the report's RecordSource and have it reference the form for its criteria. Select . . . . From. . . Where YourDate Between Forms you would just use two separate OpenReport methods. One for each criteria. keywords: date, Megan Microsoft Access, Microsoft Access, Access Syntax, report, Local, report in Access description: Create a form in Access
OK, here we go. . . as indicated, this is a the state field, the combo shows only cities in New York. The problem arises because Access only maintains properties for the Current record. As you can see in the picture below included in the current population of the RowSource. Keep in mind that it is the RecordSource which stores the selected value and it is the RowSource which populates the dropdown list than datasheet because the technique I suggest below cannot be implemented on a datasheet. keywords: Microsoft, Access, While, There, splitforms, combobox description: access splitforms OK, here we go. . . as indicated, this is a splitform question. On the design
I have several reports with specific layouts that can different queries. Rather than have the user go into the design view and change the recordsource in the report properties, I would like to be able to prompt the user when to have one report for each distinct layout (fields, grouping, sorting), and switch out the recordsource. I currently have the title display the recordsource, so it changes to the name of the query for easier identification, as well as date references. I am trying not to get too complicated as I only use MS Access to produce reports from imported data, as ARS Remedy has a crappy reporting tool. If to keep it basic for the user. Open database, open a report, be prompted for recordsource from a list, be prompted for query parameters, display and print report. If forms is
quick question: I have read that the size limit for an access 2007 database is 2GB- -does this change when the backend is on sharepoint? The reason play with. Thanks James No. It's a factor of the MSAccess database engine. No Access database can be larger than 2gb. Its' not the memory consumption, the 2gb is a database file. A database that can contain 4 million worth rows spread across tables in Access and it consumes only 220 MB. The following list of tables is specific to Microsoft Office Access 2007 databases: GENERAL ATTRIBUTE MAXIMUM Access database (.accdb) file size 2 gigabytes, minus the space
I have upgraded from SQL 2000 to SQL 2008 and Access adp 2002 to Access adp 2010. When testing, all my SQL view queries display in Access but sorted on the index value not the the sorting scheme that is created by is SELECT tContacts.* FROM tContacts ORDER BY LAST_NAME, FIRST_NAME; When I open vwContacts in MS Access the view is sorted by CONTACT_ID and not by LAST_NAME, FIRST_NAME. My collation is SQL_Latin1_General_CP1_CI_AS and my SLQ Version is 10.50.1600 and MS Access 2010. Can anyone provide and explanation to this? Thank You, Jim Hello Jim, Make sure sure that Order by is blank (so that it uses the "order by" in your access query). Check that and let us know how it works. -James Thanks for responding. I