I
iam
I have in Access 2000 a Contact Database with roughly 20 fields in a
primary table called Contacts.
On the same form, I have placed a Command Button to open a second
table called Donations in Edit Mode to be able to record A Donation.
The untimate goal being to be able to record multiple donations for
each contact.
The Donations Table has 4 Fields.
In Contacts Table I have a ContacID Text Field set up as Primary Key.
I have it set for a 1 to Many relationship to Donations using a
ContactID Text field there also.
Problem I have is, when I open Donations using the button, I want the
ContactID field in Donations to automatically fill in with whatever
ContactID value is in the record that opens it. Right now it is blank.
I have Referential Integrity set for both updates and deletes.
How do I get the value to transfer?
By adding what, to the On Click procedure attached to the button.
Right now this is the code I have there.
Private Sub Donations_Click()
On Error GoTo Err_Donations_Click
If IsNull(Me![ContactID]) Then
MsgBox "Enter doner information before entering order."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.OpenForm "Donations", , , , acEdit
End If
Exit_Donations_Click:
Exit Sub
Err_Donations_Click:
MsgBox Err.Description
Resume Exit_Donations_Click
End Sub
primary table called Contacts.
On the same form, I have placed a Command Button to open a second
table called Donations in Edit Mode to be able to record A Donation.
The untimate goal being to be able to record multiple donations for
each contact.
The Donations Table has 4 Fields.
In Contacts Table I have a ContacID Text Field set up as Primary Key.
I have it set for a 1 to Many relationship to Donations using a
ContactID Text field there also.
Problem I have is, when I open Donations using the button, I want the
ContactID field in Donations to automatically fill in with whatever
ContactID value is in the record that opens it. Right now it is blank.
I have Referential Integrity set for both updates and deletes.
How do I get the value to transfer?
By adding what, to the On Click procedure attached to the button.
Right now this is the code I have there.
Private Sub Donations_Click()
On Error GoTo Err_Donations_Click
If IsNull(Me![ContactID]) Then
MsgBox "Enter doner information before entering order."
Else
DoCmd.DoMenuItem acFormBar, acRecordsMenu, acSaveRecord, ,
acMenuVer70
DoCmd.OpenForm "Donations", , , , acEdit
End If
Exit_Donations_Click:
Exit Sub
Err_Donations_Click:
MsgBox Err.Description
Resume Exit_Donations_Click
End Sub