If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
Problem with sub-sub-form
I have table Company, sub table Share Class, and sub sub table Subscriber.
They are all linked by autonumber and the Share Class and Subscriber tables are linked by field 'Class'. A command button from the main form opens a form with linked sub form and sub sub form. However, users who want to add a new subscriber sometimes click 'Add Share Class record' in error instead of 'Add Subscriber record'. Entering subscriber details (but not new share class details) then creates a new sub sub record record which is linked by the auto number but is an orphan in relation to the share class. To avoid this, I would like to make clicking Add Share Class give a Yes?No box which asks 'Do you want to create a new share class?', and exits if the user clicks No. Or is there a better way of avoiding the problem? Can anyone advise? Thanks for any help. Dudley |
#2
|
|||
|
|||
Problem with sub-sub-form
Use some code in the before insert event of the subscriber subform to check
if the share class subform is on a new record. Here's some sample code to use in the before insert event. Dim strMsg As String Dim frmParent As Form Set frmParent = Me.Parent If frmParent.NewRecord = True Then Cancel = True strMsg = "Enter a share class first" MsgBox strMsg, vbExclamation, "Cancelled..." End If Set frmParent = Nothing Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "Dudley" wrote in message ... I have table Company, sub table Share Class, and sub sub table Subscriber. They are all linked by autonumber and the Share Class and Subscriber tables are linked by field 'Class'. A command button from the main form opens a form with linked sub form and sub sub form. However, users who want to add a new subscriber sometimes click 'Add Share Class record' in error instead of 'Add Subscriber record'. Entering subscriber details (but not new share class details) then creates a new sub sub record record which is linked by the auto number but is an orphan in relation to the share class. To avoid this, I would like to make clicking Add Share Class give a Yes?No box which asks 'Do you want to create a new share class?', and exits if the user clicks No. Or is there a better way of avoiding the problem? Can anyone advise? Thanks for any help. Dudley |
#3
|
|||
|
|||
Problem with sub-sub-form
Perfect. Many thanks for your help.
Dudley "Jeanette Cunningham" wrote: Use some code in the before insert event of the subscriber subform to check if the share class subform is on a new record. Here's some sample code to use in the before insert event. Dim strMsg As String Dim frmParent As Form Set frmParent = Me.Parent If frmParent.NewRecord = True Then Cancel = True strMsg = "Enter a share class first" MsgBox strMsg, vbExclamation, "Cancelled..." End If Set frmParent = Nothing Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia "Dudley" wrote in message ... I have table Company, sub table Share Class, and sub sub table Subscriber. They are all linked by autonumber and the Share Class and Subscriber tables are linked by field 'Class'. A command button from the main form opens a form with linked sub form and sub sub form. However, users who want to add a new subscriber sometimes click 'Add Share Class record' in error instead of 'Add Subscriber record'. Entering subscriber details (but not new share class details) then creates a new sub sub record record which is linked by the auto number but is an orphan in relation to the share class. To avoid this, I would like to make clicking Add Share Class give a Yes?No box which asks 'Do you want to create a new share class?', and exits if the user clicks No. Or is there a better way of avoiding the problem? Can anyone advise? Thanks for any help. Dudley . |
Thread Tools | |
Display Modes | |
|
|