I am having a difficult time creating and populating a new record in Access through a VBA built form. What is interesting to me about this is that the code I am using to create this record is used elsewhere in the application and works fine. But when used here, no immediate record is created. However, if I go to a different form in the application and create a record, the record is created AND the autonumber is updated PAST the point where the non-existent record would have been. For the life of me, I cannot figure out why this would be. Is the record somehow tied to the form (I sure haven't set anything like that)? I've searched high and low for any hint that might lead me to solving this issue and feel quite vexed.
Thank you for your time.
Thank you for your time.
Code:
Private Sub save_Click()
Dim curDatabase As Database
Dim newSubMaster As DAO.Recordset
Set curDatabase = CurrentDb()
Set newSubMaster = curDatabase.OpenRecordset("subMaster")
If Masters Then
MyVal = Combo0.Value
newSubMaster.AddNew
newSubMaster("Master").Value = MyVal
newSubMaster("Employee") = Me.Employee.Value
newSubMaster("AssignDate").Value = Me.AssignDate.Value
newSubMaster("Due Date").Value = Me.DueDate.Value
newSubMaster("First Contact").Value = Me.FirstContact.Value
newSubMaster("First Meeting").Value = Me.FirstMeeting.Value
newSubMaster("Ext Date").Value = Me.ExtDate.Value
newSubMaster("Delivery Date").Value = Me.DeliveryDate.Value
newSubMaster("Directorate").Value = Me.Directorate.Value
newSubMaster("Notes").Value = Me.Notes.Value
Call MsgBox("Masters " & MyVal, vbOKOnly, "xXx")
ElseIf SubMasters = True Then
Else
Call MsgBox("All False", vbOKOnly, "xXx")
End If
newSubMaster.Update
Set newSubMaster = Nothing
Set curDatabase = Nothing
End Sub