Queries :: Change Query Column Name Based On Text Box Value
Nov 8, 2013Is there a way of using a text field value as the heading for query column?
ie change...
Column header: FieldInATable
to
[form1].[field2]: FieldInATable?
Is there a way of using a text field value as the heading for query column?
ie change...
Column header: FieldInATable
to
[form1].[field2]: FieldInATable?
I have created a cross tab to extract pipeline and sales for Q1 2014, Q2 2014, Q3 2014 & Q4 2014... the user can select the quater from a multivalued text box...
Now for the final output, have created another query which pull the above four quarter in each column from the cross tab...now the problem arises when i change the quarter to Q2 2014, Q3 2014, Q4 2014 & Q1 2014..it gives an error "Microsoft office Access database does not recognizes "Query name" as a valid field name or expression".
The error is because the second layer of query does not identifies Q1 2014.
How do i make access change the column automatically when the Q1 changes to Q2...
I have inherited an Access 2003 database and have been asked to improve the functionality of said database. Specifically, I have been asked to create some charts for improved reporting. I used the wizard to create a crosstab query to support the chart(s):
Code:
PARAMETERS [Forms]![Switchboard]![ActualDate] DateTime;
TRANSFORM Sum(qryPMCompletion.CountOfWOs) AS SumOfCountOfWOs
SELECT qryPMCompletion.PA_Priority
FROM qryPMCompletion
GROUP BY qryPMCompletion.PA_Priority
PIVOT qryPMCompletion.wo_Completed
WITH OWNERACCESS OPTION;
Now what has happened is that the wo_Completed is a Yes/No field so my column headings and therefore my legend comes up as "-1" and "0" instead of "Closed" and "Open".
Is there anyway to change the name of the column headings or shall I just create my own legend?
I need a query's field to change to what is selected in a combo box.
Example,
I select product 1 in the combo box on a continuous form, after the update there is a requery. The form now displays the data from product 1.
I have tried putting [forms]![form1]![combo1] into the field box of the query. But this only makes the form display "product 1" in every row, it does not take any data from the table.
In MsAccess 2007,I want each row color to change based on a column value in the report.
For example: Select Name,Age,Salary from table 1 -creates 3 rows.
Name Age Salary
A 15 1000
B 25 2000
c 35 3000
if Salary column is less than 1001,row should be in red- Row 1
if Salary column is less than 2001,row should be in green -Row2
if salary is less than 3001, row should be orange-Row3 .
How to do conditional color formatting of the entire row in Msaccess2007 based on a column value of each row.
Is it possible to change to bold font the text column of a datasheet view?
View 3 Replies View RelatedHow to change a combo box to a text box control in a subform for a field that is based on a two-column value list. I want to be able show the value in the unbound column (which is a text value instead of a number).
My subform has a field called "ProjectStatus". This field is a value list in my projects table with the following row source:
1;"Built";2;"Unbuilt";3;"Active";4;"On Hold";5;"Completed (Master Plan)";0
So, it is set as a two-column value list with a number data type for the bound column. In my forms, column 1 is made invisible (set to 0") so that only the text value is shown to the user. This works fine with combo boxes.
However, I want to change the unsightly combo box to a text box and show the text value of the unbound column (this form will only be used to show data not for entry). When I change it to a text box control, the value that appears is a number, of course.
If ProjectStatus were based on a table, rather than a lookup value list, I would query it but I am not sure how it should be done with a value list. I could just store the text value instead, I guess, and redo a bunch of stuff or I could create a "Status" table and redo a bunch of stuff (this seems like my lot in life lately) but I feel like there should be some way to do this.
I have a Graph that uses a crosstab query to generate the data. Its only a simple query. One of the fields is project type, but in the query this changes to a number instead of text? I would like to have this as text but don't know how to go about it. I have searched forums and tried Allen Browne's suggestion on specifying column headings but no luck.
I have attached the initial query and the crosstab query in the screen shot as well as the graph. My aim is to get the project names in the legend, instead of 1, 2 as shown.
I am trying to run a query and display the results in a report (the report side of it is childs play and not a problem). The problem I am having is that I have a search form which should allow the user to search any one of 6 fields (text boxes) or a combination of each.
If the user enters something into a field then that search criteria must match. I wanted to have it so if all fields are left blank then it will show all entries in the database (but it isn't, it shows a blank report). I also wanted it to allow partial completion of boxes.
So for instance if I have 5 customers (Jones, Jonson, Jonus, jimjonkins, Janis) and I type "Jon" into the name field then I would like it to show the first 4 records as they all contain "jon" somewhere in their name but its not, its only allowing exact matches.
I currently have '[forms]![Search_Customer]![Search_Name]'.
I have a table x where the field value is selected via a combo box in a form that is populated from another table z.
When I look in x, it appears to have correctly stored the text from z, not the ID number.
I then built a Query, qX, which looks in x and grabs the fields I want. That query shows the text correctly in each selected field.
Now when I build a form, frmQx and use a List control, it displays some of the fields as ID values from the original table z, not the text values.
How can I get round this? I've searched and searched for an answer, sigh. Maybe I'm just not quite certain how to phrase the search.
I would like to change the text formatting (color, italics, bold etc) of the contents of a control based on a boolean value in the underlying datasource of the report.
For instance, I have a report that generates a "Proforma Invoice" i would like to ability italicize the prices of certain items based based on a boolean value (EstimatedPrice) in the underlying datasource.
Is Access SQL able to do this:I want the value from a particular column, whose name is derived from the value in the field of another column?
Eg.
Col1 Col2 Col3 Col4 Col5
1 ABC 234 Col2 ABC
2 BCD 345 Col3 345
3 CDE 456 Col2 CDE
4 DEF 567 Col2 DEF
5 EFG 678 Col3 678
6 FGH 789 Col2 FGH
As you can see, I want the value in column 5 to be derived from the value in Column 4.Is this possible to be done in SQL.
I am trying to run a simple update query to copy data from one column (Addrl1)to another column (Working_Addrl1) within the same file and I can't for the life of me figure it out. Then I need to repeat for addrl2 and addrl3 to working_addrl2 and working_addrl3.
View 7 Replies View RelatedHi :
I have a question,
Table1:
Company, Start Month, End Month, Fees, Calc
ABC_________Mar-05___Mar-05____7 ____1
ABC_________Mar-05___Apr-05____7_____2
ABC_________Apr-05___Apr-05____5_____4
I used crosstab to make this format
Company, Start Month, Fees, Mar-05 , Apr-05
ABC_______Mar-05 _____7_____1_______2
ABC_______Apr-05______5 ____________4
I want to change column position as following order:
Company, Start Month, Mar-05 , Apr-05, Fees
ABC_________Mar-05____1_______2_____7
ABC_________Apr-05____________4 _____5
I tried to use this code:
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim qd As QueryDef
Set db = CurrentDb
Set qd = db.QueryDefs("report_crosstab")
qd.fields("Fees").OrdinalPosition = 4
It doesn't work for crosstab query.
Can anybody tell me how to change the column position of the query?
Please let me know, thanks.
I inherited a spreadsheet that uses an Index (Match formulate to return a value. I want to use Access to manage the data going forward. I am just starting to build my tables in Access so I have some flexibility and want to do it right. Here is a sample of the data:
KeyEnroll JanFebMarAprMay
abc1/2013103521
def3/201300789
ghi5/201300008
So if Enroll date starts in Jan I want the 10 amt returned from the Jan column. If the Enroll date starts in March, for that client I want the March amy returned, etc.
results: for client "DEF" the amt returned should be "7" because their enrollment date is 3/2013.
I have a form with a combobox, textbox, a button and a listbox.
Currently the button checks if the textbox is empty and if it is, it runs a SQL query to select data using the combobox value in the where clause, else it selects data using the textbox value in the where clause
I need to be able to type or select values in both controls and use those values in the SQL query as a where.
I am looking to add a column in a query that will give a Y or No to previous column data if it contains TEXT or NUMBER (It could read "TEXT" or "NUMBER" or even Y for text or N for number).
View 3 Replies View RelatedI have a field called density which needs to be updated to show either 10, 20, 30, 40, 50,60, 70 or 80 depending on a number of variables, for example: If market location is 'hot' and unit type is 'house' and discounted is 'no' then show '10' in the density box.
or perhaps:
If market location is 'cold' and unit type is 'apartment' and discounted is 'no' then show '20' in the density box.
I have tried all sorts of expressions and queries but have really reached the limit of my know how and can't solve it. Is it even possible to do this in Access?
I'm trying to create a query to work out the total amount to invoice based upon some selections. Currently my query looks at the values in several fields (numberOfRollsUsed etc) by taking the value in these fields and multiplying by a fixed amount to calculate the total.
What I would like to add to the query is fixed values based upon some check box selections. So if check box A is selected, add 5 to the total, is check box B is selected, add a further 10, and so on. All fields and check boxes are held within the same table (Job).
Am I being daft or trying to do something in the worst way possible? I'm actually adding this to an existing system so I don't have so many options to completely redesign the system to calculate this in a better way.
I have a Access 2003 file and I want to filter anywhere where there last name is "expired" and change the column first name to say "no". How do I do that?
View 1 Replies View RelatedI have a column "CAT" each time that CAT switches between 0 and 1, I would like my query to auto-create a "grouping" and increment the group by 1. What I am looking for is the output as shown below.
ID CAT GROUP
67 0 1
68 0 1
69 0 1
70 1 2
71 1 2
72 0 3
73 0 3
74 0 3
75 0 3
76 1 4
77 1 4
I have about 20 columns in a query and each row is a customer.
The columns are either pass/fail but are text fields and not a yes/no set up. I want to get the percentage of a pass in the column.
I am writing a very complex 'if statement' query expression. I need to create an alias column based on data from two data fields.
Here's the logic:
True: If [PP] = "WG" or "WS" or "WL" and If [GR] > 10 Then "Skilled" or
[GR] Between 6-9 Then "Semi - Skilled" or [GR] <6 Then "Unskilled"
False: "GS"
I'm trying to change a 1,2,3 in a table to display NA, Yes, No on a form.
I have an Infopath form with a n/a,yes,no drop down that is dumped into Access. Infopath requires a value be tied to them so it is 1,2,3. So in Access, my table shows the numbers and not the text. I would like to know how to get my access forms to show the text instead. Not sure if I should be setting the field criteria in my query to say if this field is a 1 make it Yes, if 2 make it NO, if 3, make it NA. Or if there is something completely different to do.
I found a workaround by going into the query and using Find and Replace but I need this to update itself automatically.
I am trying to come up with a simple way for users to query the database and pull back entries relating to the (potentially vague) data they input.
I know how to run a query based upon data input in a form ("=[Forms]![FormName]![FieldName]"), and I know I can do this several times in one query.
However, if one of the fields is blank, the query doesn't return anything.
Is there a way to use only one query, but still allow the user to leave search criteria blank? The only thing I can think of is by using a very convoluted VB script and creating a query for each possible combination of criteria.
It's not an error-checking issue, either, as entering info into all of the fields isn't required.
For reference, the searchable fields are:
Agent Name, Beginning Date, Ending Date (intended for a date range), Request Type, and District Name.
A user could then search for any requests made by an Agent; any requests by an agent within a date range; any requests made by anyone in a date range; ad nauseum.
There are quite a few combinations, there, and I'd rather not create a query for each one (or code the VB conditionals to choose the right one).
I hope I'm clear in what I'm trying to accomplish :o
Thanks in advance!
I have a combo named cbogroup. I have a tblGroup with several records (active, non-active, nursery, etc.). One of the records is *ALL*. Using the CboGroup the user can pick any of the records. Howeverr, if they pick the *ALL* record, I want the query to pull up animalID based on all records in the TblGroup. If another record is picked (i.e. nursery), then the query will pull up only animalIDs that are in the 'Nursery'.Can I put a (iff then) in a query in order to differentiate a query based on all group records or a query based on only one record?
View 14 Replies View Related