A Microsoft Office (Excel, Word) forum. OfficeFrustration

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.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Problem with sub-sub-form



 
 
Thread Tools Display Modes
  #1  
Old January 20th, 2010, 08:06 PM posted to microsoft.public.access.forms
Dudley
external usenet poster
 
Posts: 68
Default 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  
Old January 20th, 2010, 08:55 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default 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  
Old January 21st, 2010, 09:55 AM posted to microsoft.public.access.forms
Dudley
external usenet poster
 
Posts: 68
Default 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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 12:50 AM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.