This is such a simple question, it has to be - I have very little experience with Access and VBA but have read and watched so many videos my mind is mush. I cannot get a new record to appear in a sub form.
I have a form, the main form called [ContactMaster], on that form are two sub forms, one called [DiveProfile] and the other called [StudentProfile]
I have three tables - [Contact] with primary key called [ID], [DiveProfile] and [StudentProfile] each have a foreign key called [CustomerID] - there is a relationship between the foreign keys and the primary key.
The purpose of this database is to keep track of potential customers, add some data to their dive profile if they've dove with us and/or then add some data to their student profile if they've taken classes with us. Not every contact will have a dive or student profile - some contacts can have just a dive or student profile - some can have both. We want to eventually be able to search and sort so we can send those annoying emails to different types of customers. The main form with the subforms needs to be simplistic so that someone can easily navigate around to view/edit/add the known information about the contact.
The form opens just fine, the first contact has contact info, dive profile and student profile info in the tables already - you can see all three forms and the info.
There is an unbound combo box [cboFullName] on the main/parent form that I use to search for an existing contact - it works perfect in a way. If a contact is pulled up that doesn't have a dive or student profile, those form areas are blank, nothing can be seen in them and I think I'm ok with that, it wouldn't matter either way really. Here's the code for the combo box events that calls up the new contact:
Private Sub cboFullName_AfterUpdate()
On Error Resume Next
Dim rst As Object
Set rst = Me.RecordsetClone
rst.FindFirst "[ID]=" & Me.cboFullName.Value
Me.Bookmark = rst.Bookmark
End Sub
And
Private Sub Form_Current()
On Error Resume Next
Me.cboFullName.Value = Me.ID.Value
Me.AllowEdits = False
End Sub
The problem I'm struggling with is when I need to add say dive profile data to an existing contact, I can't get the sub form [diveprofile] to go to a new record. Even on the main form, when trying to add a new contact - the main contact info can be entered but there is just a blank area in the [diveprofile] section. It'd be nice to be able to add this info using the edit button on the main form. I've tried going to a new record, I've tried changing the value of [CustomerID] (which always seems to be null even after setting it to have a default value). It almost seems as though because there's no record in [DiveProfile] associated with the record in [ContactMaster] - the form [DiveProfile] doesn't even open or populate.
This has got to be stupid simple, please help!!