Access 2007 Combobox displaying wrong results from table - sql-server

I have four ComboBoxes that are linked to SQL Tables and then they are linked to a log table.
The problem I have is that the combobox is displaying the correct options but only logging the ID value.
So say I have a combobox called Location and it has 3 locations:
Cape Town
Dallas
London
The ComboBox is showing those 3 choices in the drop down but when the choice is logged it will only return the values 1,2 or 3 and not the cities
Here is the row source:
SELECT Location.ID, Location.Location FROM Location ORDER BY Location.ID, Location.Location;
But when I tried swapping the Location and ID order around it then displays the values and then logs the cities.
Also this is only an issue since I linked the tables to SQL when they were local tables it worked fine.
I must be missing some sort of search field in the source query, can anyone help me please
Thanks
Dan

I managed to solve it, I had to take ID out of the equation completely and then add into extra location columns in my row source
It ended up like this:
SELECT Location.Location, Location.Location, Location.Location FROM Location ORDER BY Location.Location;
To be honest, I stumbled across this and it works. So that will do for me!

Related

Identify elements that do not appear in the period (Google Data Studio)

I have a table that shows the recurrence of purchasing a product, with the columns: product_id, report_date, quantity.
I need to list in a table the products that are more than 50 days unsold. The opposite I managed to do (list those that were sold in the last 50 days) but the opposite logic has not yet been able to implement.
Does anyone have any tips?
An example of the table:
product_id,date,report_date,quantity
329,2019-01-02 08:19:17,2019-01-02 14:34:12,6
243,2019-01-03 09:19:17,2019-01-03 15:34:12,6
238,2019-02-02 08:19:17,2019-03-02 14:34:12,84
170,2019-04-02 08:19:17,2019-04-02 14:34:12,84
238,2019-04-02 08:19:17,2019-04-02 14:34:12,8
238,2019-04-02 08:19:17,2019-04-02 14:34:12,100
238,2019-08-02 08:19:17,2019-08-02 14:34:12,100
238,2019-10-02 08:19:17,2019-10-02 14:34:12,100
170,2020-01-02 08:19:17,2020-01-02 14:34:12,84
170,2020-01-02 08:19:17,2020-01-02 14:34:12,84
There are many steps to do this task. I assume the date column is the one to work with. Your example from table includes duplicated entries. Is it right that at the same time the order is there twice?
So here are the steps:
At first add an calculated field date_past to your dataset:
DATE_DIFF(CURRENT_DATE(),date)
To the dataset add a filter SO_demo with:
include date_past<30
Then blend the data with it self. Use product_id as Join key. Only the 2nd dataset has the SO_demo filter. Add to the dimension of this dataset the calculated field sold_last_30_days with the formula "yes".
In the table/chart to display add a filter on the field include sold_last_30_days is Null.

Populate dependent combox with Unique values VBA excel

I have created a user form for adding inventory.
I have 2 combobox in the form
Category = combobox1 (housekeeping, Electricals, Cafetria etc) for these categories I am populating combox1 with rowsource property
Itemsname - combobox2 - I want to populate this combobox based on the category selected in combobox 1
The problem I am facing is the items name repeat if there are more than 1 itemsname then all items name show up in the combobox2 which i dont want. I want to see unique values. I will give you example of entries
ColumnA(Category) ColumnB(itemsname) ColumnC (Vendorname)
Cafeteria Beans Cafe Coffee Day
Housekeeping liquid soap Sevak Industries
IT Monitors Infotech solutions
IT Keyboard Infotech solutions
IT Monitors Raj computers
see screenshot the above columns gets messed up : https://prnt.sc/10cbh30
Now in the above example I populate categories combobox 1 with unique values because number of categories are fixed so I have saved them separately and I pick them with rowsource
The main problem arises when I populate combobox 2 with items name. Same Item can be bought from different vendors so Monitors we are buying from different vendors so there are two entries. In combox 2 I see 2 entries of monitors but I want to see only one since the name is same.
Note I am using for loop and adding items in the loop in combobox 2 so it scans each entries of monitor twice so it adds up monitor twice
Can anyone help on this I am frustrated I cant figure out how to get unique values

how to format the specified cell value in two different formats in SSRS Report

I have SSRS report data where we will have two different thing in some of the cells, For example:
Old Values in SourceDB
FirstName LastName
Robin Son
BOB Alice
Updating the DB values:
FirstName LastName
Robin S
BOB A
After some update, we will have the changes and new & old values in Audit Table so the report will be created like this.
FirstName LastName
Robin was: Son now: S
BOB Was: Allice now: A
Is it possible to have the Was value in Red color and the now value in Green Color.
In worst case if it is not possible how to make the whole cell value into red.
Thanks for the suggestions or answers or even feedback's are appreciated.
If you can't change your Audit table per Ashiko's very sensible recommendation to hold the Was and Now values in seperate columns, you will need to parse out the relevant parts of your string value in your report.
One way you can do this is through placeholders that have expression based values. In your SSRS table, add 4 placeholders to a table that is based on your Audit dataset, with the following expressions as their Label and Value:
Was: - ="Was: "
Old Value - =replace(left(Fields!LastName.Value,instr(Fields!LastName.Value," Now:")-1),"Was: ","")
Now: - ="Now: "
New Value - =mid(Fields!LastName.Value,instrrev(Fields!LastName.Value,":")+2,99999)
You can then format the individual placeholder items as you would normal text, with some one colour and others another.
If you do this correctly, you should end up with something like this:
Design View:
Rendered:
Do be aware though, that if you do resort to splitting your string values in this manner, if that pattern you are searching for (eg: Now: in the old value or : in your new value) you will get undesirable results in your report.
If this is an entirely internal report for monitoring purposes, this is probably not an issue. If this will be customer facing however, I strongly recommend that you add additional columns to your Audit table for the Old and New value to allow you absolute control.
Did you try this?
Select the cell
Click F4 to open cell properties or right click the properties
In font tab , Select Color
4 Select Underneath Expression
5 Write as
=iif(Fields!ColumnName.Value = "WAS","Red","Green")

adding new records to a subform in access

Ah! I think I figured out part of the problem. I am trying to add a new Line Item by using the PartNumber to control the data in the Line Item. This won't work because I use PartNumber as the Primary Key in tblPartData; so it won't let me add an new Line Item because of a Key Violation in tblPartData. What I really need to do is change the FKInvoiceNum.
Basically I built my queries wrong and got confused. So I've just spent about 10 hours banging my head against this. When what I should have done was just written down a describe the problem, and then think about that for awhile. You know step back and look at it from a different angle.
Thanks for providing me a venue where I had to describe my problem succinctly for others. But next time I'll write up my question then let it sit for a couple of hours; to save you all some time.
I have an Access Database with a Form and a Subform for an invoicing system based on queries to the following tables:
tblInvoiceData (InvoiceNum, FKCustomerID, InvoiceDate)
tblCustomerData (CustomerID, all data pertaining to the customer -- sorry there are about 20 fields)
tblLineItemData (FKInvoiceNum, FKPartNum)
tblPartData (PartNumber, PartDescription, FKManufacturerID)
qryInvoiceExpandedData (InvoiceNum, FKCustomerID, InvoiceDate, CustomerID, and all the Customer data fields)
qryLineItemExpandedData (FKInvoiceNum, FKPartNum, PartNumber, PartDescription, FKManufacturerID, and all the manufacturer data fields)
The Main form is frmInvoiceDetails and is based on qryInvoiceExpandedData. The Subform is frmLineItemDetail and is based on qryLineItemExpandedData (includes the following fields: FKInvoiceNum, FKPartNum, PartNumber, PartDescription, FKManufacturerID, ManufacturerID, ManufacturerName) as a continues form.
The problem is that in edit or creation mode I can not change any Line Item Data, or add new Line Items. Can anyone show me where my mistake; I need to be able to change the Line Item Data in the form and can't figure it out.
Apologies if this question type was answered else where, I was unable to find it -- I expect I'm not asking the right question of the search field.

SSRS Matrix - one value/row Adjacent?

I have a problem that I have been trying to solve... I Think it is fairly easy but I am new to SSRS. I have made a matrix showing the values of 2 different columns per country on one row. However I want to show only 1 value per row, that means that each country should get 2 rows each.
I Think it has something to do with adjacent but I can't get it right :(
At the moment it looks like this:
France 10 20
But I want it to look like this (don't the dashes...):
France 10
France --- 20
I think this should be possible to do without coding, I just can't find the right property/or Tablix function.
Is there anyone out there who can help me?
Change your data source so that it splits the rows. So for example:
select Country, Value1
From CountryTable
Union All
Select Country, Value2
From CountryTable
You will have to consider your sorting to make sure that your rows are aligned how you need them.
This feels like a weird requirement. But, setting the Row Grouping to Country and then Value should achieve this if I'm understanding your data structure properly.

Resources