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  

Prompt for input if another field is not blank



 
 
Thread Tools Display Modes
  #1  
Old September 8th, 2004, 11:12 PM
jh
external usenet poster
 
Posts: n/a
Default 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  
Old September 9th, 2004, 07:05 AM
John Vinson
external usenet poster
 
Posts: n/a
Default

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  
Old September 9th, 2004, 10:57 PM
jh
external usenet poster
 
Posts: n/a
Default

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  
Old September 9th, 2004, 11:03 PM
external usenet poster
 
Posts: n/a
Default

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  
Old September 10th, 2004, 07:20 PM
John Vinson
external usenet poster
 
Posts: n/a
Default

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  
Old September 10th, 2004, 10:44 PM
jh
external usenet poster
 
Posts: n/a
Default

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

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

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


All times are GMT +1. The time now is 05:16 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.