473,599 Members | 3,160 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Copy field contents to another field based if a totally different field = true

3 New Member
I have no coding experience. I want to copy the contents from one field in table1 to a field in table2 if a totally different field in table2 is true.

I have created a form based on a query containing both of the two tables mentioned above. I am trying to attach the code to "After Update" for the totally different field mentioned above in table2.

Here is what I have tried and is obviously not working.

= Update [tblVenues].[VenueContactMai lingAddress]
SET [tblVenues].[VenueContactMai lingAddress] =
[tblContacts].[VenueContactPhy sicalAddress]
WHERE ([tblVenues].[VenueContactMai lingAddressSame] = 0)
Jun 29 '16 #1
2 801
1,275 Recognized Expert Top Contributor
You can accomplish this without resorting to running an update query. The data is right there on the Form.

Try this:
Expand|Select|Wrap|Line Numbers
  1. if me.VenueContactMailingAddressSame<>False then
  2. me.VenueContactMailingAddress= me.VenueContactPhysicalAddress
  3. end if
This assumes all of those objects are on the screen, named in that way.

Jul 1 '16 #2
3 New Member
Hi jimatqsi,
I had problems using what you sent. Also, I have made some modifications. I hope you can help me with this.
I have 2 tables (tblContacts and tblVenues).

I have created physical addresses and mailing addresses in the tblContact table. I have created a relationship between the 2 tables on the common field "ContactID. "

I have created a query made up of fields from both the tblContacts and tblVenues tables. I have created a form based on that query.

Here is what I would like to do.

If the tblContact table's field "ContactMailing AddressSame" (a check box for true/false) is not null, I would like to copy the data from and to the following fields (both in the tblContacts table).

ContactPhysical Address ====> ContactMailingA ddress
ContactPhysical City ====> ContactMailingC ity
ContactPhysical State ====> ContactMailingS tate
ContactPhysical Zip ====> ContactMailingZ ip
ContactPhysical Country ====> ContactMailingC ountry

Also, how would I use the code? Would I use the Expression Builder, the Code Builder, or the Macro Builder?

Any help would be greatly appreciated.
Jul 1 '16 #3

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

Similar topics

by: Jason Joines | last post by:
I have a table with an email field that contains values of the form uid@domain. I need to populate a new field called uid with just the uid part of the email address. Is there any way of using select to just retrieve the part before the @ and insert it into the uid field? Thanks, Jason Joines Open Source = Open Mind ========================
by: Mike | last post by:
I'm sure this has been covered before in the newsgroup but have had no luck locating it. I have two tables: InstMonitors & MonModDesc Structure of MonModDesc: Model, Description Structure of InstMonitors: CompName, Make, Model, Description, Serial, PurchDate, WarrExpDate
by: Rooksarii | last post by:
Hello folks, Let me first apologize for any impropper terminology I may use as I am presently trying to broaden my Office knowledge by diving into Access head on. My specific problem is this. I have a field in one of my tables that references a value in another table via a list box. Next to it, instead of manually creating another list box to go along with it, I would like to have this other field acknowledge that the value in it's...
by: geronimo_me | last post by:
Hi, I'm trying to compare two TITLE fields from different tables to locate anomolies - however Table1 TITLE field contains a dot(.) after some of the entries, however i want to remove the dot so i can compare properly (the dot is irrelavant to my comparisons): Record1 Table1 TITLE = MISS. Table2 TITLE = MISS
by: geronimo_me | last post by:
Hi, I am atempting to compare part of a field with the whole of another field in access. Is this possible? Basically I have 2 tables with the following info: Table1 Field1 = MR.
by: C8H10N4O2 | last post by:
How would I set one fields value equal to something based on another table in a form. For instance, could I implement VB on enter in a form's combo box to set a number field equal to one or zero in another table based on the value entered entered in this form( I have a list of 15 names and if a supervisor enters one name as the assignee I want a field DeptID to be either a 1 or 2. I was thinking it would go something like this Private...
by: Coll | last post by:
I have a field that I would like to display on a report only if the value of another field matches a certain criteria. If it does match I need the label & the field value to display (though I'm sure I can create a text box joining the label & the field). If it does not match, then I need the label/field (or text box) to be hidden. Any suggestions? Also, there are multiple values (maybe 5) that would meet the criteria (they are being...
by: dkyadav80 | last post by:
<html> /// here what shoud be java script for: ->when script run then not display all input text field only display selection field. ->when user select other value for institute only this field display not display degree text field ->when user select other value in the selection field for degree then text field display and wise versa //// <bodly> <table>
by: mburch2000 | last post by:
I have an Excel file with two tabs: Source & Target. Using VBA (Macro), I am attempting to take data in Source and place in Target. The fields are normally manipulating in some form, so not a straight copy and paste. My problem: how do I group rows based on "RuleID" (1st field) and make a decision based on results in "AcctNum" (5th field) and then place results in either DID1 (6th field) or DID2 (7th field)? See Logic below and in attached...
by: hunths | last post by:
I need help. I would like to copy the contents of one field to another field if the contents of a totally different field is true. I have no code experience and have absolutely no idea of how to make this work. This is what I have tried so far. = Update . SET . =. WHERE (. = 0)
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...
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,...
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...
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...
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,...
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...
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...
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
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.