How to do a partial copy/paste recordset - ms-access

Under MS Access 2013, I want to copy a record to a new one or an existing record.
I wonder if it is possible to do a partial copy/paste.
Here is my simple example of my DataSet:
PayID PAyDate PeriodeName EmployeeID Income Taxes
001 2019/01/02 1 5 1500 201
002 2019/01/15 2 5 1500 201
003 2019/01/30 3 5 1500 201
004 2019/02/06 4 5
005 2019/02/06 5 5
Please note that
my complete datasheet has 12 fields which must be copied)
PayID is an autoNumber
I would like to be able to:
copy/paste Income and Taxes fields to an existing record (ex: PayId#3 to payId#4 )
copy/paste Income and Taxes fields to a new record (ex: PayId#3 to a new one, ie #6)
I already have a contextual menu in my datasheet with the standard copy paste command buttons but I don't know how to substitute them for a partial copy paste command.
What should I have as OnAction Callback functions?
callBackCopy()
callBackPaste()
Thanks for the support.

It may not be obvious, but you can Copy&Paste ranges of columns and rows (and both) in an Access datasheet. This works in Access 2010 and 2016, so I assume it works in 2013 too.
You need to move the mouse cursor to the edge of a cell, so it becomes a "+" icon.
Here is a sample video: https://i.imgur.com/H1VHIlo.mp4
(German Access, but you will get the idea)
It shows copying 2x2 cells into new records. You can do the same to overwrite existing records, then you must select the matching number of rows as copy target.

Related

Replace entire row based on duplicates columns in csv file

I have two csv files, each of which has two columns. File A is the master file which contains the order of the items, which is important. File B has some (but not all) updated information that needs to replace the old information in file A.
How do I replace the old values in column 2 of file A with the new values from column 2 of file B, but only where the values in column 1 are duplicates?
For example:
File A
Name
Number
Bob Smith
12
Mary West
67
Joe Soap
77
Edith Little
41
File B
Name
Number
Mary West
83
Edith Little
16
Desired result
Name
Number
Bob Smith
12
Mary West
83
Joe Soap
77
Edith Little
16
I feel like there should be a simple solution to this that I'm just missing, but I haven't had any luck with searching for a method.
Edit:
I attempted to solve the problem using replace duplicates in google sheets, which resulted in the correct values, but the order was lost. I ran up against the same problem using Sublime Text in that I can keep the new values quite easily, but I can't seem to find a way to keep them in the position of the old values.
Try the following
=INDEX(IFNA({Q2:Q7,IFERROR(VLOOKUP(Q2:Q7,T2:U5,2,0),R2:R9)}))
(Do adjust the formula according to your ranges and locale)

how do I find duplicate serial numbers in 2 separate columns in Microsoft access?

I am having an issue with Microsoft access running a query and don't know how to go about running the query I need. i am trying to find duplicate S/N's in 2 columns, for example
COMPUTER SN HARD DR SN MONITOR 1 SN MONITOR 2 SN
1 456 123 654
2 528 234 758
3 963 654 234
as shown above computer 3 is showing the same monitor from both 1 and 2 and I can get Microsoft access to show duplicates from up and down or side by side and I cant figure out how to do diagonal as well. I am using Microsoft access 2016 and any help would be great thank you. I have been looking for the past few days and I don't know what SQL is or how to do that in access but everything I can find shows me how to do up and down (I got that working) or direct side by side (I got that working as well) nothing showing me how to do diagonal as well.
so I had someone else from my work come up and help and we created a query with this in the comment block,
In (SELECT [MONITOR 2] FROM [COMPUTER S/N] WHERE [COMPUTER S/N].[MONITOR 2] NOT IN ("NA")) And Not In ("NA")
and had monitor 1 as the column selected. so it will take each S/N from monitor 1 and check monitor 2 for the same data, then I have to have another query for each column duplicates. the end phrase and not in ("NA") is only to take out the spots where people only have one monitor.

MS Access - #Name? Error on DLookup (Textbox on Form, Lookup From Query)

I'm having a bit of an issue with an MS Access database that I'm working on. I'll try to give as much detail as I can. All of my SQL code is what MS Access has generated for me.
First of all, I have a query that tells me how many hours a person is putting into project work -
SELECT Functions.f_Person, Sum(Functions.f_Hrs) AS SumOff_Hrs
FROM Functions
GROUP BY Functions.f_Person;
f_Person is Text in a combo box (linked to e_person in 'Employees' table which is a primary key), f_Hrs & Sumoff_Hrs are numbers. I realise that I am not using best practice for that primary key. This database will be rebuilt after proof of concept.
From this query I have created a second query that takes all of a person's contracted time and subtracts the previous total -
SELECT q_TotalHrs.f_Person, Employees.e_Hrs, q_TotalHrs.SumOff_Hrs, [Employees]![e_Hrs]-[q_TotalHrs]![SumOff_Hrs] AS HrsAvailable
FROM Employees, q_TotalHrs
GROUP BY q_TotalHrs.f_Person, Employees.e_Hrs, q_TotalHrs.SumOff_Hrs, [Employees]![e_Hrs]-[q_TotalHrs]![SumOff_Hrs];
This gives me something along these lines -
Person Contract Hrs Sumoff_Hrs HrsAvailable
----------------------------------------------------
Ali 37 12 25
Al 37 1 36
Andy 37 1 36
Dave 37 13 24
Gaz 37 1 36
John 37 1 36
Paul 37 6 31
George 37 2 35
Ringo 37 1 36
I also have a form (frm_Projects) which is used for creating new projects which has a subform (frm_Functions) for adding people to these projects. This subform populates the 'Functions' table referenced in the first query.
So the user would add a function (f_Function) and then the number of hours required (f_Hrs) and selects a name from a combo box (f_Person). The subform view is set to 'Continuous Forms'.
Now my problem:
I have created a text box at the end of the input line on the subform which should show the hours available for the selected person. In the text box properties I have added this code into the Control Source -
=DLookUp("[HrsAvailable]","[q_HrsAvailable]","[f_Person] =" & [Forms]![frm_Functions]![f_Person])
This gives me the #Name? error on the form view.
I realise that this is a common problem, but can't seem to solve it on my own database using solutions that I've found. Could somebody help me to fix this?
----------- Edit ----------------
New formula as provided by #Andre
=DLookUp("[HrsAvailable]","[q_HrsAvailable]","[f_Person] =" & [Forms]![frm_Projects]![frm_Functions].[Form]![f_Person])
I'd say you need
Forms!frm_Projects!frm_Functions.Form!f_Person
assuming that the subform control (!) on frm_Projects has the same name as its source form, i.e. frm_Functions. That's normally the case, but not mandatory.
Edit
If you still have the combobox name change, it's
Forms!frm_Projects!frm_Functions.Form!cbx_Person
and since I now realize that f_person is a string, you need single quotes around the parameter:
=DLookUp("[HrsAvailable]", "[q_HrsAvailable]",
"[f_Person] = '" & [Forms]![frm_Projects]![frm_Functions].[Form]![f_Person] & "'")

How to Autoexpand to a Duplicate Entry in a Combobox?

Salvete! I have an Access database (.accdb) with a combobox that will let me select records by typing into the box and pushing enter. Now, the list to which the combobox is bound has (of necessity) duplicates. What I want to do is to find a way to get the text of a duplicate item into the combobox. Problem is that AutoExpand only seems to see the first match.
I have a list with two columns, that looks like this:
Bob 20
Harry 5
Mike 45
Mike 46
Mike 78
Sherry 24
My code gets the index of what is displayed in the combobox, and then grabs the data from the second column.
How can I make Autoexpand display the second match (Mike, in this example)?
If you want the user (and the form) to distinguish between the 3 rows that say "Mike", you'll need to display both columns. Set your combobox to display both columns. Then, when the user types "M", the box will center on the first of the 3 rows with Mike.
One way this can be done is by changing your row source to "Select Name, Num from Tbl". Or just use the built-in wizard when making a new combobox.

how to sum and subtotal by project code in vs 2005 reporting service

I need to display the sub total for each project code as follow.I am using the VS2005 reporting service.
Code EmployeeName Projectcode Salary TotalIncome
Leave TotalDetact
000 Adam ADM 1000 1000
100 100
ELS 1100 1100
100 100
010 Eris ADM 15000 15000
500 500
Subtotalfor ADM 16000 16000 // I dont know how to do in here.
Project 600 600
2 persons
1 person ELS 1100 1100
100 100
It looks like you want to have a summary of the data by project at the end of the report? The problem is that you have multiple projects for people and you are ordering by person, so standard grouping won't work.
You have some alternatives:
Change the grouping to be project, then by person. Now you can summarize by project but of course you lose the person summary. Not ideal.
Create a second table in this report after the table you have in there now and do the summary there. You might want to create a new summary dataset for this table.
Use custom code (or a custom DLL) to do the calculating of the project summary for you. Right-click project surface-Properties-Code and you can write VBA functions in there that you can call from the table.
Use a subreport.
Option 2 is probably the easiest.