Hi Karen
Set the DefaultValue of the "AddSame" field to True. Then you can create a query like this:
qryActivityAddress
SELECT ActivityID_PK,
IIf(AddSame, o.Address, a.ActAddress) AS ActivityAddress,
IIf(AddSame, o.City, a.ActCity) AS ActivityCity,
IIf(AddSame, o.Zip, a.ActZip) AS ActivityZip,
IIf(AddSame, o.County, a.ActCounty) AS ActivityCounty
FROM tblActivities AS a INNER JOIN tblOrganization AS o
ON a.OrgID_FK = o.OrgID_PK;
Then you can join this query in another table using tblActivities to derive the correct address for the activity, depending on the value of AddSame.
Best wishes,
Graham [Access MVP since 1996]
From: MS_Access_Professionals@yahoogroups.com [mailto:MS_Access_Professionals@yahoogroups.com]
Sent: Thursday, 2 April 2015 15:16
To: MS_Access_Professionals@yahoogroups.com
Subject: [MS_AccessPros] Update shipping and billing addresses
Hello. I'm really struggling with this one. I've got two tables - one with the organization information and another one with information on the different activities it hosts. Sometimes the address of the activity is different than the organization but sometimes they are the same. I am trying to avoid having to type in the information twice if the addresses are the same. Here's what I have set up so far.
I have two separate forms for the organization and activity tables. The organization ID joins the two tables together. First the organization form is filled in. If it is hosting an activity, the activity form opens up with the organization field populated. Here are the some of the fields in the tables. I won't list them all because there are too many and probably aren't relative to this issue.
Table name: tblOrganization
Field names: OrgID_PK, OrgName, Address, City, Zip, County
Table name: tblActivities
Field names: ActivityID_PK, OrgID_FK, AddSame, ActAddress, ActCity, ActZip, ActCounty
Tables are joined by the OrgID fields. The AddSame field is a checkbox that the user will check if the addresses are supposed to be the same.
What do I need to do to copy the organization address fields to the activity address fields? Do I need to run an update query? Do I write something for the OnClick or AfterUpdate property?
Thanks for your help.
Karen
Posted by: "Graham Mandeno" <graham@mandeno.com>
| Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (2) |
Tidak ada komentar:
Posting Komentar