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  

subform condition



 
 
Thread Tools Display Modes
  #1  
Old April 7th, 2008, 08:41 PM posted to microsoft.public.access.forms
Alan
external usenet poster
 
Posts: 459
Default subform condition

Hello,

I have a form with a subform on it that is used for data entry. What I'm
trying to accomplish is that when the main form is open, the user cannot
close it out until he/she fills something into the subform.

I thought of using a RecordSet.RecordCount method but is this the best way
to do it?

Here's the code I wrote but Access doesn't like it so I'm suspecting I'm
writing it incorrectly:

If Me!sbfmQuotePkgHeader.RecordsetClone.RecordCount = 0 Then
MsgBox ("The PACKAGE SUMMARY section is empty. Please fill in PACKAGE
SUMMARY.")
Else
DoCmd.Close
End If

Thanks in advance.

Alan

  #2  
Old April 7th, 2008, 08:47 PM posted to microsoft.public.access.forms
Alan
external usenet poster
 
Posts: 459
Default subform condition

I guess I should clarify, what I meant is that the subform cannot be blank.
If there are records in the subform already associated to the main form, then
it's fine but if the user tries to leave the subform blank on exit, it should
stop the close action and a msgbox should appear indicating they need to fill
in the subform.

"Alan" wrote:

Hello,

I have a form with a subform on it that is used for data entry. What I'm
trying to accomplish is that when the main form is open, the user cannot
close it out until he/she fills something into the subform.

I thought of using a RecordSet.RecordCount method but is this the best way
to do it?

Here's the code I wrote but Access doesn't like it so I'm suspecting I'm
writing it incorrectly:

If Me!sbfmQuotePkgHeader.RecordsetClone.RecordCount = 0 Then
MsgBox ("The PACKAGE SUMMARY section is empty. Please fill in PACKAGE
SUMMARY.")
Else
DoCmd.Close
End If

Thanks in advance.

Alan

  #3  
Old April 7th, 2008, 10:19 PM posted to microsoft.public.access.forms
Alan
external usenet poster
 
Posts: 459
Default subform condition

It's ok. I figured it out. Just missing ".Form".

"Alan" wrote:

Hello,

I have a form with a subform on it that is used for data entry. What I'm
trying to accomplish is that when the main form is open, the user cannot
close it out until he/she fills something into the subform.

I thought of using a RecordSet.RecordCount method but is this the best way
to do it?

Here's the code I wrote but Access doesn't like it so I'm suspecting I'm
writing it incorrectly:

If Me!sbfmQuotePkgHeader.RecordsetClone.RecordCount = 0 Then
MsgBox ("The PACKAGE SUMMARY section is empty. Please fill in PACKAGE
SUMMARY.")
Else
DoCmd.Close
End If

Thanks in advance.

Alan

 




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 05:02 PM.


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