access SQL package with transposing - ms-access

I decided to share one with you my dataset in an excel file attached, it is composed of 3 tabs, each tab represents a table + a 4th tab that represents the expected result.
the designation table is initially a relation that has become a table so it registers IDbeneficiaire + IDcontrat
Frankly I lost 2 days on that and I still can not do this on Access, I need this result for next week in an automatic way on Access. can you help me get this result with a SQL access request please
enter link description here

Related

Skipping a serial number in MS Access report

I am working on an MS Access report. It is about employee service records. This report asks a parameter which is the ID of the staff member and displays multiple records of its punishments. What I wanted was to skip a serial number of records based on type of punishment. For instance, I do want to skip number for a punishment that contains word 'aside'. So for this, I have added a serial number using a textfield making its control source=IIf([PType] Not Like "*aside*",1,0) its result like this.
The problem here is number 5 is repeating 2 times(as it contains 'aside' string). But I want that highlighted row shouldn't contain any number and next two to it should be numbered 6 which is correct already. My background is from MS SQL server. I can't handle complex VB code.

Usage of the column "ExecutionId" in the table "[dbo].[ExecutionLog2]"

Can any one of you please help me by providing more details of the column "ExecutionId" in the table "[dbo].[ExecutionLog2]". I thought for each and every report execution from report server it
will create one execution id. However I find one "ExecutionId" has repeated 70 times (Same "ExecutionId") in one of the report server database. So wondering what does it mean/usage of the column "ExecutionId" in the table "[dbo].[ExecutionLog2]"
The internal identifier associated with a request. Requests on the same user sessions share the same execution id.
Sql Server Reporting Services Docs
The ExecutionID field appears to be related to (one or more) executions of a specific report. As long as you are running the same report, the ExecutionId appears not to change, regardless of how many times the report is run, even if the report is run with different parameters and even if the output format is changed (e.g. render on screen, pdf, csv etc.)
As soon as you navigate away from the report, a new ExecutionId will be generated for the next report execution.

Inventory Transactions between locations - Ms Access

I'm currently working on an Inventory Control db that allows tracking stock transactions from one location to another but, I can't figure out how to create 2 records simultaneously on a "Transactions" Table based on the same data.
Basically, I'd like to create a form where I enter Item, Qty, From Location, To Location, Lot and have 2 records created simultaneously with a negative qty on the "From Location Record" and a Positive Qty on the "To Location Record".
I've attached a screenshot of the Form I envision and the desired Output in Data Records.
I have some experience working with Access forms and tables but this development is beyond my knowledge.
I Hope someone can help.
Thanks!
Form & Table screenshot
You would run couple of simple insert queries. One to move the stock out from the existing location, one to add it back to the new location.
If you are not well versed with writing VBA I would use the query designer, and include your form text boxes as the criteria. Save the queries, then use your button to run the queries one after the other.
I would also be tempted to bring in the existing location as a combo box based on the part number selected. That way you won't try and move something from a location that isn't correct,

Access Form Field Logic

I'm trying to make access conditionally only show rows that meet a certain condition, allow me to give you some background info before I proceed :
I've created an Access form and linked it to a test DB on my machine. The particular table I am interested in contains the following (important) rows :
ID , Office, Name, SecurityNumber
The thing is, ID is not unique. There are two Office locations, and each Office has it's own set of unique ID numbers. This means that ID 10 here and there may or may not be the same person. (this data comes out of a legacy security system we're not looking to change yet, so I cannot change it)
But ID -is- unique to each Office.
SO! I created an Access form with TABS! Two tabs, one for each office. What I am trying to achieve now is :
Have the ID/Name/SecurityNumber fields for each tab populate with only rows that match it's particular 'Office' value.
Thank you for reading and thank you for helping! :D
If you want the data for the office locations presented in separate tab page controls, you could use subforms on the pages which differ only in the WHERE clause of the queries used as their record sources. So for the Office1 subform, the query could be:
SELECT ID, Office, [Name], SecurityNumber
FROM YourTable
WHERE Office = 'Office1'
ORDER BY [Name];
Then for Office2, the query would be the same except for the WHERE clause:
WHERE Office = 'Office2'
As I understand your question, that approach would do what you're asking for.
However, that's not really the easy "Access way" to do it. Instead consider a combo box control to allow your users to choose which office they want to view. In the code for the combo's after update event, either modify the SELECT statement used as the form's record source or create a filter expression an apply it.
Also, since you're pulling the form's data from SQL Server, consider whether you want your form to load every record for the selected office location. It may not be much concern if you have only a few to moderate number of rows for each location, but if you'll be dealing with multiple thousands of rows it could be. In general, you should try to avoid pulling copious amounts of data across the wire; pull sparingly instead ... only what you need for the immediate task at hand.

Copying a record in VBA

I work with a product that comes in a 2000lb sack and placed on a pallet. When this product is made it has many different elements that are tested and each test has a field that the numerical data is placed in. Each of these records of tests are then assign a number, for example, L20444.
Now we have the ability to take that 2000lb sack and convert it into 80 20lb bags. Only 40 20lb bags can fit on one pallet, taking now the one pallet L20444 and making two pallets that have the number L20444. This causes a problem with inventory because the number L20444 can only be assign one warehouse location, not two.
So my bosses what to create a number that is almost the same, but different enough to place the second pallet in the warehouse. The second pallet will now be L20444B. It will still have all the same tested numbers and is a "copy" of the original L20444.
My question is can I take the record L20444 and copy all the data for that record and then save it as L20444B so that it can be placed in the warehouse.
So is it possible for VBA to copy a record, rename it, and then save it in the same database as a new record?
Any help would be appreciated, Thanks.
If I'm reading you right it sounds like you want a SQL statement to create a new record.
You're using Microsoft Access? I would recommend first creating a query that does this in the query editor. It will be an Append query, something along the lines of:
INSERT INTO TableA ( ID,col1, col2 )
SELECT [ID] & "B" AS NewName,col1, col2
FROM TableA
WHERE (([ID]="L20444"));
Test this first to make sure it's doing what you want, and make "L20444" into a parameter ([OldID], or something). Then add some code in your VBA script that executes this query. It should pop up asking you for OldID when you run it.
Then you'll need to learn how to execute parameterized queries from VBA.
Something like this:
Set qdf1 = CurrentDb.QueryDefs("myQuery")
qdf1.Parameters("OldID") = theOldID
qdf1.Execute
Not tested, search VBA help for QueryDefs if my syntax isn't quite right.
Why don't you create a new table, which tracks the location of the two pallets (and the new number(s)), which links back (with a foreign key) to the single record for the stock in the original table?
That should work, and will avoid what will otherwise become a nightmare of redundant data.