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
|
|||
|
|||
Prompt for input if another field is not blank
I have a subform entitled "SLsubform". I need to prompt
the user for information if a field is not null. So... If "ActualEnddate" is Not Null, then prompt user to put in a Y or N in the field "SpecMet". If "ActualEnddate" is Null, then don't allow user to put in a Y or N in the field "SpecMet". Hope this is enough info. If not, let me know. Thanks in advance. |
#2
|
|||
|
|||
On Wed, 8 Sep 2004 15:12:04 -0700, "jh"
wrote: I have a subform entitled "SLsubform". I need to prompt the user for information if a field is not null. So... If "ActualEnddate" is Not Null, then prompt user to put in a Y or N in the field "SpecMet". If "ActualEnddate" is Null, then don't allow user to put in a Y or N in the field "SpecMet". Hope this is enough info. If not, let me know. Thanks in advance. You'll need some VBA code in the BeforeUpdate event of SLsubform; untested air code... Private Sub Form_BeforeUpdate(Cancel as Integer) If IsNull(Me!ActualEnddate) Then If Not IsNull(Me!SpecMet) Then MsgBox "You cannot enter anything in SpecMet", vbOKOnly Cancel = True Me!SpecMet.SetFocus End If Else If IsNull(Me!SpecMet) Then MsgBox "Please specify a SpecMet value", vbOkOnly Cancel = True Me!SpecMet.SetFocus End If End If End Sub John W. Vinson[MVP] (no longer chatting for now) |
#3
|
|||
|
|||
Thanks for the info, we are certainly on the right path.
However, I am getting an error. I tried to test it by putting in an ActualEndDate and it prompts me to "Please specify a SpecMet value". But when I click OK, it gives me: Run-time error '438' Object does not support this property or method When I press Debug, it is highlighting the Me! SpecMet.SetFocus. Then I commented out the Me!SpecMet.SetFocus and it seems to be working. Should I have commented this out? Thanks. -----Original Message----- On Wed, 8 Sep 2004 15:12:04 -0700, "jh" wrote: I have a subform entitled "SLsubform". I need to prompt the user for information if a field is not null. So... If "ActualEnddate" is Not Null, then prompt user to put in a Y or N in the field "SpecMet". If "ActualEnddate" is Null, then don't allow user to put in a Y or N in the field "SpecMet". Hope this is enough info. If not, let me know. Thanks in advance. You'll need some VBA code in the BeforeUpdate event of SLsubform; untested air code... Private Sub Form_BeforeUpdate(Cancel as Integer) If IsNull(Me!ActualEnddate) Then If Not IsNull(Me!SpecMet) Then MsgBox "You cannot enter anything in SpecMet", vbOKOnly Cancel = True Me!SpecMet.SetFocus End If Else If IsNull(Me!SpecMet) Then MsgBox "Please specify a SpecMet value", vbOkOnly Cancel = True Me!SpecMet.SetFocus End If End If End Sub John W. Vinson[MVP] (no longer chatting for now) . |
#4
|
|||
|
|||
I meant to say, I tried to test it by putting in an
ActualEndDate and not putting in anything in SpecMet. It does give me the prompt to "Please specify a SpecMet value". But when I click OK, it gives me: Run-time error '438' Object does not support this property or method When I press Debug, it is highlighting the Me! SpecMet.SetFocus. Then I commented out the Me!SpecMet.SetFocus and it seems to be working. Should I have commented this out? Thanks. -----Original Message----- Thanks for the info, we are certainly on the right path. However, I am getting an error. I tried to test it by putting in an ActualEndDate and it prompts me to "Please specify a SpecMet value". But when I click OK, it gives me: Run-time error '438' Object does not support this property or method When I press Debug, it is highlighting the Me! SpecMet.SetFocus. Then I commented out the Me!SpecMet.SetFocus and it seems to be working. Should I have commented this out? Thanks. -----Original Message----- On Wed, 8 Sep 2004 15:12:04 -0700, "jh" wrote: I have a subform entitled "SLsubform". I need to prompt the user for information if a field is not null. So... If "ActualEnddate" is Not Null, then prompt user to put in a Y or N in the field "SpecMet". If "ActualEnddate" is Null, then don't allow user to put in a Y or N in the field "SpecMet". Hope this is enough info. If not, let me know. Thanks in advance. You'll need some VBA code in the BeforeUpdate event of SLsubform; untested air code... Private Sub Form_BeforeUpdate(Cancel as Integer) If IsNull(Me!ActualEnddate) Then If Not IsNull(Me!SpecMet) Then MsgBox "You cannot enter anything in SpecMet", vbOKOnly Cancel = True Me!SpecMet.SetFocus End If Else If IsNull(Me!SpecMet) Then MsgBox "Please specify a SpecMet value", vbOkOnly Cancel = True Me!SpecMet.SetFocus End If End If End Sub John W. Vinson[MVP] (no longer chatting for now) . . |
#5
|
|||
|
|||
On Thu, 9 Sep 2004 15:03:16 -0700,
wrote: I meant to say, I tried to test it by putting in an ActualEndDate and not putting in anything in SpecMet. It does give me the prompt to "Please specify a SpecMet value". But when I click OK, it gives me: Run-time error '438' Object does not support this property or method When I press Debug, it is highlighting the Me! SpecMet.SetFocus. Then I commented out the Me!SpecMet.SetFocus and it seems to be working. Should I have commented this out? Since I cannot see your form, and do not know what controls you have on it, I WAS GUESSING. Perhaps I should have made it clearer that I was doing so! The SetFocus was intended to put the cursor into the textbox (if there is one) into which the user should have entered Y or N. If that control has a different name on your form, use that name; if there is some other manner in which the field SpecMet is updated, do something appropriate *for your form*. John W. Vinson[MVP] (no longer chatting for now) |
#6
|
|||
|
|||
This worked perfectly! Thank you so-oo much. I just
changed the name of the field to be SpecMet and it worked like a charm. -----Original Message----- On Thu, 9 Sep 2004 15:03:16 -0700, wrote: I meant to say, I tried to test it by putting in an ActualEndDate and not putting in anything in SpecMet. It does give me the prompt to "Please specify a SpecMet value". But when I click OK, it gives me: Run-time error '438' Object does not support this property or method When I press Debug, it is highlighting the Me! SpecMet.SetFocus. Then I commented out the Me!SpecMet.SetFocus and it seems to be working. Should I have commented this out? Since I cannot see your form, and do not know what controls you have on it, I WAS GUESSING. Perhaps I should have made it clearer that I was doing so! The SetFocus was intended to put the cursor into the textbox (if there is one) into which the user should have entered Y or N. If that control has a different name on your form, use that name; if there is some other manner in which the field SpecMet is updated, do something appropriate *for your form*. John W. Vinson[MVP] (no longer chatting for now) . |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Update Part# field where is blank | JUAN | Running & Setting Up Queries | 4 | August 19th, 2004 08:54 PM |
Blank Field | Eric | General Discussion | 4 | June 19th, 2004 01:26 AM |
'This page left blank' field does not work on Roman numbers etc. | Craig Flores | General Discussion | 3 | June 8th, 2004 12:31 AM |
Make a field lookup dependent on the value in another field of a record? | Susan A | Database Design | 8 | May 22nd, 2004 09:10 PM |