Solved

Programming & Database problem in MS ACCESS 97

Posted on 2004-04-21
3
190 Views
Last Modified: 2008-03-17
I have two tables.  PACC and JACC for Primary account holder and joint account holder.  There is a 1:1 relationship.  The PACC table primary key is ACCNUM and the JACC Table has PACC as a Foreign Key with an Autonumber index. I have two forms: Primary Account Information and Joint Account Information. I do not have any problem writing to the PACC table from the Primary Account Information Form.

Now, I have a button on the Primary Account form that displays the Joint account form.  I want 3 different text boxes to display the ACCNUM, FNAME, LNAME from the PACC table on the JOINT Account Form, then I want to enter the Joint Account information into the JACC table from the JOINT Account form.  

I have attached the code that writes to the Primary Account table:  Becareful of the comments.  You can see what I was trying to do with a SQL statement.

If more info is needed email at spzbiegien@hotmail.com

Private Sub CmdEnter_Click()
Dim dbs As Database
Dim rs As Recordset
Dim sSQL As String
Dim ACNUM As Control

'Open the current database
Set dbs = CurrentDb
Set ACNUM = [Forms]![FRMMAIN]![ACCNUM]
'Open the current recordset

'sSQL = "SELECT tblTEST.ACCNUM, tblJTEST.ACCNUM, tblTEST.ACCSTATUS, tblTEST.ACCLEAVESTATUS, tblTEST.ACCSOCIAL, tblTEST.ACCFNAME, tblTEST.ACCMI, tblTEST.ACCLNAME, tblTEST.ACCADDRESS, tblTEST.ACCCITY, tblTEST.ACCSTATE, tblTEST.ACCZIP" FROM tblTEST INNER JOIN tblJTEST ON tblTEST.ACCNUM = tblJTEST.ACCNUM;"
'Set rs = dbs.OpenRecordset("SELECT tblTEST.ACCNUM, tblJTEST.ACCNUM, tblTEST.ACCSTATUS, tblTEST.ACCLEAVESTATUS, tblTEST.ACCSOCIAL, tblTEST.ACCFNAME, tblTEST.ACCMI, tblTEST.ACCLNAME, tblTEST.ACCADDRESS, tblTEST.ACCCITY, tblTEST.ACCSTATE, tblTEST.ACCZIP FROM(tblTEST INNER JOIN tblJTEST ON tblTEST.ACCNUM = tblJTEST.ACCNUM)")

'Set rs = dbs.OpenRecordset(sSQL)
Set rs = dbs.OpenRecordset("tblTEST")

With rs
.AddNew
    !ACCNUM = [Forms]![FRMMAIN]![ACCNUM]
    !ACCSTATUS = [Forms]![FRMMAIN]![ACCSTATUS]
    !ACCLEAVESTATUS = [Forms]![FRMMAIN]![ACCLEAVESTATUS]
    !ACCSOCIAL = [Forms]![FRMMAIN]![ACCSOCIAL]
    !ACCFNAME = UCase([Forms]![FRMMAIN]![ACCFNAME])
    !ACCMI = UCase([Forms]![FRMMAIN]![ACCMI])
    !ACCLNAME = UCase([Forms]![FRMMAIN]![ACCLNAME])
    !ACCADDRESS = [Forms]![FRMMAIN]![ACCADDRESS]
    !ACCCITY = UCase([Forms]![FRMMAIN]![ACCCITY])
    !ACCSTATE = UCase([Forms]![FRMMAIN]![ACCSTATE])
    !ACCZIP = [Forms]![FRMMAIN]![ACCZIP]
 .Update
 .Bookmark = rs.LastModified
 End With
 rs.Close
 
 'initialize the form
 Call INITIALIZE
 ' SetFocus to text box.
 ACNUM.SetFocus
End Sub
0
Comment
Question by:spzbiegien
3 Comments
 
LVL 6

Expert Comment

by:nathaniel
ID: 10884880
pls. check your email
0
 
LVL 17

Expert Comment

by:walterecook
ID: 10884904
EE Questions should not be handled by email.  If more info is needed, please post it.
http://www.experts-exchange.com/Databases/MS_Access/help.jsp#hi99

Walt
0
 
LVL 54

Accepted Solution

by:
nico5038 earned 500 total points
ID: 10886790
Hmm, I guess we have a design issue here.
When you have a joint account holder table, only data that differs from the Primary account holder should be stored.

Personally I would use a Primary account holder mainform and a linked joint account holder subform.
This way the Foreign key of the joint account holder will be filled automatically when there's no joint account holder yet and when there's already one then access will automatically show the linked joint account holder.

Getting the idea ?

Nic;o)
0

Featured Post

Ransomware-A Revenue Bonanza for Service Providers

Ransomware – malware that gets on your customers’ computers, encrypts their data, and extorts a hefty ransom for the decryption keys – is a surging new threat.  The purpose of this eBook is to educate the reader about ransomware attacks.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article is a continuation or rather an extension from Cascading Combos (http://www.experts-exchange.com/A_5949.html) and builds on examples developed in detail there. It should be understandable alone, but I recommend reading the previous artic…
Overview: This article:       (a) explains one principle method to cross-reference invoice items in Quickbooks®       (b) explores the reasons one might need to cross-reference invoice items       (c) provides a sample process for creating a M…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

813 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now