473,652 Members | 3,045 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy field with DoCmd


Copy the content of a field into another field

In my table Customers i want to copy the content of the field
"Employee"
which is a text field, into the field MOL, also a text field
I need to copy the field through code, with DoCmd.statement
Can somebody help me ?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 12 '05 #1
1 8510
Doesn't make a lot of sense to me to store the same value in two fields in
the same record, but you can do it through code or a query. This code will
set "MOL" to the value of "Employee" in every record:

Dim db as DAO.Database
Dim rs as DAO.Recordset
Set db = CurrentDB
Set rs = db.OpenRecordse t("Customers" )
If Not(rs.EOF and rs.BOF) Then 'rs is not empty
rs.MoveFirst
Do Until rs.EOF = True
rs.Edit
rs("MOL") = rs("Employee")
rs.Update
rs.MoveNext
Loop
End If
rs.Close
Set rs = Nothing
Set db = Nothing

Or you can use a Query... here's the SQL... you can execute it manually, or
from code with the .Execute method:

UPDATE Customers SET Customers.MOL = [Customers].[Employee];

If you want to do this only for specific records, obviously then you'll have
to select just the records you want to update, but you didn't mention that.

Larry Linson
Microsoft Access MVP
"Svelte Poshy" <sv******@yahoo .com> wrote in message
news:3f******** *************@n ews.frii.net...

Copy the content of a field into another field

In my table Customers i want to copy the content of the field
"Employee"
which is a text field, into the field MOL, also a text field
I need to copy the field through code, with DoCmd.statement
Can somebody help me ?

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 12 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
10449
by: Shyguy | last post by:
I want to create two buttons on a form. One would allow the user to Copy the contents of the current records memo field, the other would allow them to print. I set up a report based on the memo field, and it works. But, it seems wrong since I had to create a huge text box to accommodate memo fields with a lot of text. Thanks for any help, ShyGuy
2
10925
by: news.hp.com | last post by:
I have situation where I need to copy multiple records (only certain fields) from a Rules table to an Events table based on a selection identified in a combo box. When the selection is made in a parent table, multiple records in a child table are affected. However, I'm a bit weak on programming experience. INSERT INTO is not suitable. Any ideas? When the combo box update property is triggered, the code needs to accomplish: IF...
1
2558
by: Sean Howard | last post by:
Dear All, As is my want I need to do something in Access that seems simple but cannot fathom out. I have main form with two subforms, both datasheets with an almost identical table structure. I want to add the functionality to copy records from subformA to subformB WITHOUT USING COPY/PASTE. The reasonfor this is that I must
1
1757
by: Geir Baardsen | last post by:
Hi! As you can see I have worked with my code and done some changes. Now the code will execute, because of this, and because I took away some code in the OnCurrent event that was probably causing a clash. It does in fact copy the new Invoice number and the data from tblOrderDetails, but still missing is the CustID-field, that it refuses to copy. The CustID-field is a Combobox on frmOrders, and is by no way locked or... I again have...
19
3463
by: davidgordon | last post by:
Hi, I need some pointers/help on how to do the following if it possible: In my access db, I have the following: Tables: Products, Sub-Assembly, Product-Pack Table, Products
3
5400
lwwhite
by: lwwhite | last post by:
(Access 2003) Here's what I want to do: enable users to double-click a field in a datasheet-view subform and thereby save the contents of that field to the Windows clipboard so that they can then paste it into another field. I tried to set it up as a DblClick event on the field with this syntax: DoCmd.DoMenuItem acFormBar, acEditMenu, acCopy, , acMenuVer70 However, when I tested, I got a message that the Copy action wasn't available. So...
15
7356
by: sara | last post by:
I have a Memo field in a table to hold notes from a conversation a social worker has had with a client (this is for a non-profit). If the user needs to update the memo field, I need to find the original record (which I am doing fine - getting the correct key) and I need to update the "notes" with the new value from the form, which I store in a String Variable. (I've tried storing in a Variant variable; didn't work for me)
3
9234
by: Richnep | last post by:
Hi all, I have tabbed subforms where I need to copy one field value from one subform over to another subform. Although I can run an update query to accomplish this I would like to do it through VBA. sub tables relationships are 1:N with the main table. So the recods display like this in the subform:
5
11127
by: phill86 | last post by:
Hi I have a main form that holds records for scheduled meetings, date time location etc... in that form i have a sub form that has a list of equipment resources that you can assign to the meeting in the main form. I have two buttons in the sub form one for selecting and copying all the records and another for pasting the records this enables me to copy and paste the equipment resources from one scheduled meeting to another. The buttons are...
0
8367
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
8703
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8467
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7302
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...
1
6160
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4145
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4291
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1914
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1591
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.