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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 | |
|
|