It appears that I have not explained myself of what I have been trying to do. In any case I have managed to find a solution to my problem as follows.
The last of three cascading comboboxes is Combo17. On the afterupdate event I have put the following code.
Private Sub Combo17_AfterUpdate()
Me.FrmServicesSub.SetFocus 'sets focus to the subform
DoCmd.GoToRecord , , acNewRec 'opens up a new record in the subform.
Me.FrmServicesSub.Form.ServiceRef = [Combo17].Column(1) 'fills up the field ServiceRef depending on column 1 of the choice on the combobox.
Me.FrmServicesSub.Form.itemprice.Enabled = True ' enables itemprice field so that additions and any edits can be made
Me.FrmServicesSub.Form.itemprice = [Combo17].Column(2) ' updates another field on the new record on the subform.
Me.FrmServicesSub.Form.invoiceno = 0
Me.FrmServicesSub.Form.item_amount.Enabled = True 'enables item_amount field so that the number can be added
If Me.Combo0 = "operation" Then
Me.FrmServicesSub.Form.item_amount = 1 ' conditionally fills in item_amount depending on the value in another combobox.
Me.FrmServicesSub.Form.item_amount.Enabled = False
Me.FrmServicesSub.Form.Requery ' requeries the subform so that entries are saved.
DoCmd.GoToRecord , , acLast 'goes back to the record just saved and sets focus to another field prompting the user to enter a date.
Me.FrmServicesSub.Form.servicedate.SetFocus
Else
Me.FrmServicesSub.Form.item_amount.SetFocus ' prompts the user to make an entry into another field of the original record.
End If
Me.Combo0 = "" ' empties the first combobox
Me.Combo6 = "" ' empties the second cascading combobox
Me.Combo17 = "" 'empties the last cascading combobox.
End Sub
This code is working fine for me and I am satisfied with the result. However if this could have been done more efficiently or more professionallY I would be pleased to know how.
Many thanks to all.
Louis B.