How to display concatenated value in MS Access Combobox - vba

I'm trying to fill the combobox with values from a concatenated field in a MS Access query. The embedded image is what is currently shown in the drop down box and what is shown in the box when a value is selected.
The problem is that i do NOT want the values in the drop down box to show as if in columns, but rather as a concatenated string. So, instead of ... TAYLOR | AVICHAI ... it should be TAYLOR, AVICHAI. And additionally, when the value is selected, then instead of showing just TAYLOR it would show TAYLOR, AVICHAI.
I've tried every property I can think of and tried concatenating in the original table, the query and even in vba code AFTER just grabbing the two fields from the database.
Any help? Concatenated View

You need to concatenate the values together in your query and display that field in the combo box.
SELECT peopleID, lastName & ", " & firstName AS name FROM tblPeople
And then in your the format tab of your combobox set:
column count to 2
column widths to 0";1"
This will cause only your column with a width (the combined names) to be displayed in the drop down and when selected.

The documentation says: "In a combo box, the first visible column is displayed in the text box portion of the control."
More precisely, the value shown is the value of the first column with a non-zero width.
Thus, to achieve your goal, modify your query so that it returns the following:
Taylor, Avichai | Taylor | Avichai
Raines, Patricia | Raines | Patricia
...
Then, in the combox box properties, set
the number of columns to 3 and
the column widths such that the first column is very small (but not zero).

Related

SQL Report Builder Table Dynamic Color

This might be beyond the limits of report builder.
I have an SQL Report that generates a table. The table is a fixed number of columns with a dynamic number of rows. The point of the table is to show recipe information of a system and I would like to make it more clear to a user when recipe information has been changed.
Example
+-----------+-------+-----+
| row names | Col A | Col |
+-----------+-------+-----+
| row1 | 10 | 20 |
| row2 | 14 | 20 |
+-----------+-------+-----+
The value of colA has changed so I would like to either change the cell color of row2,colA or change the font. To make it clear to a user what has changed.
I would want to do this dynamically for ever row. Basically compare to the row before and determine if I need to change colors of any of the cells.
Assuming you just mean you want to compare the previous row shown in the report then you can this is easily.
To recreate the exmaple, I used the following query in a dataset called DataSet1.
DECLARE #t TABLE(RowID int, ColA int, ColB int)
INSERT INTO #t VALUES
(1,10,20),
(2,14,20),
(3,14,20),
(4,15,21),
(5,15,22)
SELECT * FROM #t
I then created a simple table with the results sorted by RowID.
I then changed the BackgroundColor property of the cell containing [ColA] to the following expression.
=IIF(
Fields!ColA.Value = Previous(Fields!ColA.Value)
OR Fields!RowID.Value = MIN(Fields!RowID.Value, "DataSet1")
, Nothing
, "Khaki"
)
I repeated this for Col B changing the field name as applicable.
The expression simply checks if the value is the same as the previous row. For the first row with will always be false so I put a check in to see if we are formatting the first row. So if either (a) we are on the first row or (b) the number is the same as the previous number in this column, then the background is set to Nothing (the default), if neither of the conditions are met we set the background to 'Khaki'.
The end result looks like this...
The another way would be modifying the .RDL file.The RDL file basically contains XML tags so if you open them in Notepad or Visual Studio using View Code .You will find a tag called BackgroundColor for each and every column .By giving the color code in the place of existing one will get you the desired color.you can design a custom color and use it in your report.

Create a list from Table

I managed to enter data to a database via a form;
actually works like a charm.
Now, what I need, is a lookup function (preferably not a form), with which I can search a table on another worksheet.
Let's say, I have an edit field or a cell, in which I enter a term which shall be looked for in a certain column on the table in another worksheet.
I would like to get a list of all entries which contain the word and the value from another cell (an ID).
Example:
Search term: Tom
Table:
Tim | 2
Tom | 3
Tommy | 5
The List should Show Tom and Tommy and their respective IDs,
but everything I tried didn't turn out as intended (mostly didn't work at all)...

SSRS Lookup on single dataset

Hopefully you can help!
I have a single data source in my SSRS report. With this data source, I have populated a tablix. The tablix looks something like this:
SalesPerson ID Group Sales
Sarah 1 1 1234
Ross 2 1 555
Gemma 3 2 678
Jill 4 2 345
Jack 5 3 987
Peter 6 2 432
Henry 7 2 356
The report is set up to create a different page for each of the sales people. for example, on the first page of the report, only first record would be shown (the record that holds Sarah's information, the second page would show the record for Ross' information ,etc..)
The issues I face is this:
At the bottom of the report, I need to include a textbox that displays the group number that the specific employee belongs to (the employee who is currently being displayed on the page).
I think that I need to do some sort of lookup on the IDReportItem to return the group ID in order to do this, but have had no luck in my attempts.
I understand that this is a horrible way of doing things, but I am limited to using this single dataset for performing this task.
Any help you can provide will be greatly appreciated,
Thanks you!
Unfortunately there doesn't seem to be a way to do this in a single textbox, but you can do it with a second tablix that uses the same dataset.
Create your second tablix and position it at the bottom of the page, then set your grouping to be the same on both tablixes and use the second tablix to only display the group ID, plus whatever label you want.
Create a new row group for each tablix (grouping on group ID), then right click the group and browse to Group Properties -> Page Breaks and check the box that says "Between each instance of a group". Do this for both tablixes.
This is what grouping is designed for. Build your table, and set the page break attribute to true.
You can have multiple rows under your group. Since your group is a field, simply add it to the detail row.
Your grouping is obviously set up right to get the report paging correctly.
You could add a List to the report, set the grouping on that (with page break between groups)
Inside the list - Add a RECTANGLE. (this be important!)
Once you've added the rectangle, you can add another as many objects as you like. In your case I think that may be a matrix and a text box
eg
Then it just becomes as spacing issue (to get the page looking right)

Display only two fields from Access table

New to Access here... I asked a similar question the other day, but have a new twist for a different form I am creating.
Say I have a table (tblNamesAndValues) that looks like this:
Name Value
---- ----
Mary 100
Carrie 500
Terri 999
Gerrie 749
I have created a form that displays all four names and values.
My question is this: how can you make the form display only the names Mary and Terri and their values, and have the values in updateable textboxes? On top of that, is there any way to only display those two, and not the blanks underneath that allow new entries?
Thanks in advance...
You can filter the form or use a query instead of the table as table source:
select * from tblNamesAndValues where name = "Mary" or name = "Terry"
For disabling the blank line, just set the AllowAdditions property of the form to false.

Handling grouping of case sensitive data in RDLC

I have an RDLC report, I have a column chart whose X axis is shows PerformedBy person names,
Y axis shows the count of exams grouped by each PerformedBy person.
The data in the dataset contains case sensitive data.
For example, there are two PerformedBy names like 'john' and 'JOHN'.
john has Number of exams as 1 where as JOHN has 2. Currently in the chart it displays only JOHN.
The data for both 'john' and 'JOHN' are combined and shown under 'JOHN' as 3.
I want to display john with Number of exams as 1 and JOHN with Number of exams as 2.
How to handle this at RDLC level?
I have seen in some of the dicussions that I can select Data Options and then choose casesensitivity property.
But I am not seeing this option in Dataset Properties dialog.It shows only the option General.
I am using Visual studio 2010 , .NET 4.0 and SQL Server 2008 Express.
Another option I was thinking to add a Unique identifier field for the Performed By person in the dataset. In the chart
how do I group by Identifier but then display Performed by Name in X axis?
Note that I saw both records are coming in my output collection from sql query.
One way is to convert the string to ASCII code, and then put the number together
For instance 'john' => '106111104110' and John=> '74111104110'. And then group on that value
This link will explain how to convert a string to an ASCII values.
http://p2p.wrox.com/beginning-vb-6/56056-converting-set-string-its-ascii-value.html