473,769 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy all records in Subform(Datashe et view) & paste

1 New Member
Hi All,

I am trying to create a form for updating values. I have a Table - ASP with Date, Product, Q1,Q2,Q3,Q4 fields. I have a Form ASP_Main with "Date" field for filtering by the date selected. There is a subform ASP_Subform embedded in the main form.

What I am trying to achieve with a click of a button is - Filtered data shows in ASP_Subform, so Copy this whole data, change the date in ASP_Main to today's date and paste the data copied.

Why? This will make sure that I have the data last entered, and new set of data with changes. We don't want to lose any history, and any change to even a single record should produce all records with current date.

I have not been able to run the
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acSelectAllRecords
  2. DoCmd.RunCommand acCopy
  3. etc...
as I am unable to select records in the subform. The error is that "SelectAllRecor ds" is not available now.

Please help... My deadline is very close now :(

Thanks & Advance
Jul 5 '08 #1
3 12042
puppydogbuddy
1,923 Recognized Expert Top Contributor
You need to set focus on the subform control before you can run the acSelectAllReco rds command. Replace the illustrative name used below with the actual name of your subform control.
Expand|Select|Wrap|Line Numbers
  1. Me.YourSubformControl.SetFocus
Jul 5 '08 #2
nico5038
3,080 Recognized Expert Specialist
You could also trigger an INSERT query to perform your task like:
Expand|Select|Wrap|Line Numbers
  1. currentdb.execute ("INSERT INTO ASP (ASP_Date, Product, Q1,Q2,Q3,Q4) SELECT(Date(), Product, Q1, Q2, Q3, Q4 from ASP WHERE ASP_Date=#" & me.txtdate & "#)")
  2.  
I've changed the field Date into ASP_Date as Date is also a reserved word (and function as you cansee in the query). Just correct this and make sure the parentform's Date fieldname is correct.

Nic;o)
Jul 5 '08 #3
NeoPa
32,573 Recognized Expert Moderator MVP
...
Expand|Select|Wrap|Line Numbers
  1. DoCmd.RunCommand acSelectAllRecords
  2. DoCmd.RunCommand acCopy
  3. etc...
...
Although this would probably not have taken too much digging, it is nevertheless exactly what I needed to know for a job that is coming up later today, so thanks :)
Jul 8 '08 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

2
5360
by: ivan | last post by:
I have a form (CustomerImfo) that has a subform within it (order). Within that subform is another subform (OrderDetail). That subform (OrderDetail) is displayed in Datasheet view. When I am entering customers and their respective orders, the first order entered is fine with the "tab" field orders correct. On the second and subsequent orders, when I go from the Order form to the subform "OrderDetail", the curser goes to the wrong field...
1
7007
by: Thomas Zimmermann | last post by:
I have a form with a subform in datasheet view. Now, I want to trigger a procedure (P1) each time the user selects an entire column (by clicking in the heading) in the subform. The procedure (P1) I want to trigger needs to be called with the selected column as a parameter. As far as I am aware, there is no event procedure for clicking in the heading of a datasheet. So insted I need to start by having an other procedure P0, which is...
7
6261
by: Ken Mylar | last post by:
First a quick background on the form: I have a form that is normally viewed in Single form mode. It has a subform on it that is in datasheet view. The main form is for work orders and the subform is for parts used on the work order. On the main form I have a LaborTotal (from main form), PartsTotal (from subform) and TotalCost (which is Labor + Parts). All works fine as is. Now to the question: I have a button on my main form to browse...
1
3083
by: s_wadhwa | last post by:
Hi, I have a main form "frmBldgFloor" and SubForm within the main form "fsubBldgFloor". In the SubForm the values in the text fields are being populated from a recordsource. I have these values being populated in Form Detail Section. Also I have Form Footer where I have text boxes showing Sum of those recordsource values.
3
3734
by: JML | last post by:
How do I able to locked users from pasting records from column datasheet to another column? My case is I have a form that has a check box that determines when it is checked, the subform datasheet will be locked from users to edit, otherwise they can edit. I done this by locking each field in the subform successfully, but I also want the fields to be Enabled as well. Each field are locked and enabled, the problem is when you select the...
0
1582
by: arindams | last post by:
I've a form where an webrowser contains a html file. I want to copy a selective portion of the html content and paste that content in an excel 2007 file where it will be pasted as a normal text (not in HTML code). I want to have the excel part should be as it is done manually (i.e. it should be in proper format as it is in the HTML file). Platform/OS/Version : GUI/Windows XP/2005 Language :Vb.Net Private Sub frmParse_Load(ByVal sender...
2
1566
by: zandiT | last post by:
hello i have an access database which ive just put on a shared folder on the network for users to use. i tested it well, exported all the objects in a new database, converted to to an mde file, placed the mde version on the network and opened the database again just to make sure its working. but the problem is if a user opens the database, they cannot add delete or edit fields in certain tables. i have a particular from in datasheet...
0
2037
by: clarkp73 | last post by:
Hi In VBA I populate an unbound subform (datasheet view) via a recordset that can be changed using filters selected by the user. The only problem I am having is that due to the unbound nature of the subform the sorting function activated by the column header click only works once, the second time the user tries a sort an error occurs ("Data provider could not be initialized"). Is there any way I could handle the column header click in code...
0
1186
by: cpStar | last post by:
I have a form & a subform. The main form will show info on the selected customer (qry based on tblCustomers). The subform will show all the parts this customer has purchased (qry based on tblCustParts - the many side of tblCustomers). I have the subform (datasheet view) display the part number along with the specific info about that part such as Description & Price (which gets pulled from the Parts table). The user can add a part number...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9422
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9851
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2811
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.