Jumat, 22 Agustus 2014

Re: [MS_AccessPros] Update data in another table

 

Khalid-


The fields SurName and GivenName should appear in the Members table and ONLY the Members table.  Those fields should not be duplicated in other related tables.  If you need these values when looking at a related table such as CST Transaction, you should include the Members table in the query linked by MemberID and display the values from the related row in Members.

John Viescas, Author
Microsoft Access 2010 Inside Out
Microsoft Access 2007 Inside Out
Microsoft Access 2003 Inside Out
Building Microsoft Access Applications 
SQL Queries for Mere Mortals 
(Paris, France)




On Aug 23, 2014, at 7:16 AM, Khalid Tanweer khalidtanweerburrah@yahoo.com [MS_Access_Professionals] <MS_Access_Professionals@yahoogroups.com> wrote:

Hi all,

I have some forms for Search & Edit. Let me take an example of Form "Search Edit Members" its Record Source is query "Search Edit Members Query" with Sql:

SELECT Members.MembershipTitle, Members.MembershipType, Members.MemberID, Members.GenderStatus, Members.SurName, Members.GivenName, Members.MembershipStartDate, Members.MembershipExpireDate, Members.DesignationSOC, Members.Dob, Members.MemberEC, Members.Nationality, Members.Organization, Members.OrganizationDesignation, Members.EduQualification, Members.EducationStatus, Members.[Postal Address], Members.MainCityName, Members.TelephoneOffice, Members.TelephoneResidence, Members.FaxNo, Members.MobileNo1, Members.MobileNo2, Members.MemberEmail, Members.SkypeID, Members.ViberID, Members.FacebookID, Members.[CNIC Number], Members.[CNIC IssueDate], Members.[CNIC ExpiryDate], Members.PassportNo, Members.[Passport IssueDate], Members.[Passport ExpiryDate], Members.ProposedBy, Members.RecommendedBy, Members.Working, Members.Photo, Members.Country
FROM Members
WHERE (((Members.Working)=True))
ORDER BY Members.MemberID;

Table Members has Primary Key MemberID and it has one-to-many relationship with table "CST Transaction" when i do edit MemberID on this form, MemberID is updated in table "CST Transaction".

My issue is that if i edit "SurName" and "GivenName" they do not update in table "CST Transaction" and some other tables, in the same manner there may be chance of editing other fields.

I did tried with the After Update event on "SurName" field, but nothing happened may be this is wrong way i am trying.

Private Sub SurName_AfterUpdate()
    Dim varV As Variant
    varV = DLookup("[SurName]", "CST Transaction")
    varV = Me.SurName.Value
End Sub

Need help please.

Khalid


__._,_.___

Posted by: John Viescas <johnv@msn.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