I have two (2) tables (Tab1 and Tab2) in a 1-to-1 relationship based on SSN. Tab1 has fields SSN, FName, LName, Addr, City, State, Zip. Tab2 has fields SSN, FName, LName, Fee, Deposit, BalDue. Zip is Key for both tables.
Tab1 will have several thousand records (unique).
Tab2 may only have a few (unique) records based on, say, a class.
These tables each have a form (Form1 and Form2).
Form1 (Tab1) has a button to open Form2 (Tab2).
Form2 (Tab2) has a button to return back to Form 1( Tab1)
If a record is opened on Form1, the form is populated with the record if it exist, or is appended to the table.
If the button to open Form2 is clicked, I need the current record (SSN, FName, LName) to be passed to Form2. If this record (SSN) exists, I want Form2 to open the record for editting. If not, it needs be appended to Tab2.
On Form2, if a record is selected or editted, or a NEW record is added, and a button to return to Form1 is clicked, I want Form1 to be open that record if it exists (SSN, FName, LName), or the record needs be appended to Tab1.
I need to know what VB code to put on each button of the 2 forms will be.
I am pretty knew at Access Programming, so any help at all will be appreciated.
PS: Subforms do not do what I need in this particular case.
Here is the Event Procedure in Form1 I am trying to use, to no avail:
Private Sub open_Form2_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Form2"
stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
'''DoCmd.OpenForm stDocName, , , , acFormEdit
Exit_open_Form2_Click:
Exit Sub
End Sub
Thank you in advance
Chalmers H. Davis, Jr.
Tab1 will have several thousand records (unique).
Tab2 may only have a few (unique) records based on, say, a class.
These tables each have a form (Form1 and Form2).
Form1 (Tab1) has a button to open Form2 (Tab2).
Form2 (Tab2) has a button to return back to Form 1( Tab1)
If a record is opened on Form1, the form is populated with the record if it exist, or is appended to the table.
If the button to open Form2 is clicked, I need the current record (SSN, FName, LName) to be passed to Form2. If this record (SSN) exists, I want Form2 to open the record for editting. If not, it needs be appended to Tab2.
On Form2, if a record is selected or editted, or a NEW record is added, and a button to return to Form1 is clicked, I want Form1 to be open that record if it exists (SSN, FName, LName), or the record needs be appended to Tab1.
I need to know what VB code to put on each button of the 2 forms will be.
I am pretty knew at Access Programming, so any help at all will be appreciated.
PS: Subforms do not do what I need in this particular case.
Here is the Event Procedure in Form1 I am trying to use, to no avail:
Private Sub open_Form2_Click()
Dim stDocName As String
Dim stLinkCriteria As String
stDocName = "Form2"
stLinkCriteria = "[SSN]=" & "'" & Me![SSN] & "'"
DoCmd.OpenForm stDocName, , , stLinkCriteria, acFormEdit
'''DoCmd.OpenForm stDocName, , , , acFormEdit
Exit_open_Form2_Click:
Exit Sub
End Sub
Thank you in advance
Chalmers H. Davis, Jr.