I have a subform, based on a stored procedure, that returns notes of type1 or type2. Some customers may not have any notes, so the subform is blank.
I am trying to have a pop-up form open if the customer has any notes that are type2. I'm not sure what if-then statement I should be using on the Form's Current event. I only want the pop-up form to open if a type2 note is present. Otherwise, it stays closed.
I've tried that. Here's what happens when I do that. It works if the type2 note is at the top of the subform, but when it is not at the top, or first, it does not work. Also, when I do this, I get an error, "You entered an expression that has no value," if that customer has no notes at all. Any ideas?
It is a text box, but I'm not sure I understand. If I do, then the code you gave me should read:
If IsNull(MySubform!NoteType) or NoteType="Type2" Then
My question though is, won't this open the pop-up form if there is no value? I only want the pop-up form open if the NoteType field is type2. No other time. Also, this code will give me the same problem if the type2 note is not at the top of the subform or the first entry.
Or, am I supposed to enter the code you gave me as follows:
If IsNull(Type2) or Type2="" Then
That just didn't seem right. Let me know what you think. Thanks again for the help.
Here's what happens when I do that. It works if the type2 note is at the top of the subform, but when it is not at the top, or first, it does not work. Also, when I do this, I get an error, "You entered an expression that has no value," if that customer has no notes at all. Any ideas?
First, thanks for the continued help. The info is sensitive, but I think I can give you a pretty clear explanation of what's going on and what I am doing.
I have a main form with a continuous-form subform that is based on a stored procedure. We'll call the main form "mainform" and therefore the subform will be Forms!Mainform!Subform.
The stored procedure that the subform is based on yields the correct results. It displays a list of notes and the type of note in text boxes on the subform. Sometimes, a customer will not have any notes, so the stored procedure yields no results.
I have a second form that we'll call "Popup." I want this form to pop-up if and only if a customer has a note that is "type2." I have tried the code that we posted earlier and I am having two issues. First, the pop-up form is only displayed if the "type2" note is at the top of the continuous-form subform. It does not seem to look any further down the list. If it is not the first note displayed, then the pop-up form is not opened. The second issue is I receive the error I described above for any customer that has no notes at all. It seems that because the customer has no notes, the program does not know how to respond to the function, which is causing the error.
Perhaps the If-Then statement should be something that looks at the stored procedure results and says if the results have a note with type2, then open pop-up form. If there are no results or there are no notes with type2 then do nothing. Just a thought.