[mso] Re: Access 2002: Checking For Nulls On Form Close

  • From: "Jim Pettit" <j_e_pettit@xxxxxxxxxxx>
  • To: <mso@xxxxxxxxxxxxx>
  • Date: Thu, 10 Jun 2004 12:16:18 -0700

Cathy--

I;m not sure why you'd get the error. Could it be that the text fields
are either not text fields at all? That is, are they some control that;s
not allowed to receive focus?

This may be introducing slop, but if you need to get the form up and
running, you can ignore the SetFocus stuff; that was just something I
like to include to help the user along.

--Jim

-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Cathy.Evans@xxxxxxxxx
Sent: Thursday, June 10, 2004 10:14 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access 2002: Checking For Nulls On Form Close



Jim,

I could use a java jolt, too (or whatever caffeine source!), 'cuz my
brain just isn't able to handle more than one concept at a time some
days . . . :
-)

Here's where I'm messing up.  Where do I put the .SetFocus?  Tried it
after each field name in the code, but got same error message.  Do I set
it up somewhere else?
             Me.txtRequiredFieldOne.SetFocus
             Me.txtRequiredFieldTwo.SetFocus
             Me.txtRequiredFieldThree.SetFocus

BTW, thanks for foreseeing the null value problem if a user deletes
something.  You must know us when it comes to data entry!

Thanks, Cathy


 

                      "Jim Pettit"

                      <j_e_pettit@hotmail      To: <mso@xxxxxxxxxxxxx>

                      .com>

                      Sent by:                 cc:

                      mso-bounce@freelist

                      s.org                    Subject:  [mso] Re:
Access 2002: Checking For Nulls On Form      
                      06/10/2004 12:35 PM         Close

                      Please respond to

                      mso
.... 
 

 





Cathy--

Mea <maxima> culpa; that's what happens when I post code without
actually testing it...and before I'm sufficiently caffeinated:

The following lines...

             Me.txtRequiredFieldOne
             Me.txtRequiredFieldTwo
             Me.txtRequiredFieldThree

.don't do anything, and won't compile correctly! I assigned no
property, and called no method. What I meant to post was:

             Me.txtRequiredFieldOne.SetFocus
             Me.txtRequiredFieldTwo.SetFocus
             Me.txtRequiredFieldThree.SetFocus

Sorry about that. Run, and see if it makes a difference.

(By the way: some may be wondering why I idn't just check the fields for
a value of Null. The reason is that a user can 'dirty' a form by, for
instance, entering a value in a field, then highlighting and deleting
that value. The field will no longer contain a Null, but rather an empty
("") string; checking for Null will report false, but the field will
still be empty, which may not be what you want to allow. [On the table
side, that's called 'Allow Zero Length'.])

--Jim

-----Original Message-----
From: mso-bounce@xxxxxxxxxxxxx [mailto:mso-bounce@xxxxxxxxxxxxx] On
Behalf Of Cathy.Evans@xxxxxxxxx
Sent: Thursday, June 10, 2004 8:26 AM
To: mso@xxxxxxxxxxxxx
Subject: [mso] Re: Access 2002: Checking For Nulls On Form Close



Jim, what am I doing wrong?  I pasted below in my form and changed the
field names to appropriate fields, then opened the form, left fields
blank to test, exited form, and got a 'Compile error: Method or data
member not found' error.  It highlighted 'txtRequiredPROJECT'(replaced
my field name). I haven't used anything like this before, so please bear
with me, thanks, Cathy


>>Private Sub Form_BeforeUpdate(Cancel As Integer)
    If Len(Me.txtRequiredFieldOne & "") = 0 Then
        MsgBox "Please fill in Field One", vbOKOnly + vbExclamation,
"Can't Do That!"
        Me.txtRequiredFieldOne
        Cancel = True
        Me.Undo
        Exit Sub
    End If
    If Len(Me.txtRequiredFieldTwo & "") = 0 Then
        MsgBox "Please fill in Field Two", vbOKOnly + vbExclamation,
"Can't Do That!"
        Me.txtRequiredFieldTwo
        Cancel = True
        Me.Undo
        Exit Sub
    End If
    If Len(Me.txtRequiredFieldThree & "") = 0 Then
        MsgBox "Please fill in Field Three", vbOKOnly + vbExclamation,
"Can't Do That!"
        Me.txtRequiredFieldThree
        Cancel = True
        Me.Undo
    End If
End<<






------------------------------------------------------------------------
-----------------------------
The information transmitted is intended only for the person
or entity to which it is addressed and may contain confidential and/or
privileged material. If you are not the intended recipient 
of this message you are hereby notified that any use, review,
retransmission, dissemination, distribution, reproduction or any action
taken in reliance upon this message is prohibited. If you 
received this in error, please contact the sender and delete the 
material from any computer.  Any views expressed in this message are
those of the individual sender and may not necessarily reflect 
the views of the company.  
------------------------------------------------------------------------
-------------------------------

*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx
or MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the
quotes) in the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will
also allow you to change your email settings to digest or vacation (no
mail). //www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group,
send a request to mso-moderators@xxxxxxxxxxxxx and you will be sent an
invitation with instructions.  Once you are a member of the files group,
you can go here to upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************
*************************************************************
You are receiving this mail because you subscribed to mso@xxxxxxxxxxxxx or 
MicrosoftOffice@xxxxxxxxxxxxxxxx

To send mail to the group, simply address it to mso@xxxxxxxxxxxxx

To Unsubscribe from this group, send an email to 
mso-request@xxxxxxxxxxxxx with the word "unsubscribe" (without the quotes) in 
the subject line.

Or, visit the group's homepage and use the dropdown menu.  This will also allow 
you to change your email settings to digest or vacation (no mail).
//www.freelists.org/webpage/mso

To be able to use the files section for sharing files with the group, send a 
request to mso-moderators@xxxxxxxxxxxxx and you will be sent an invitation with 
instructions.  Once you are a member of the files group, you can go here to 
upload/download files:
http://www.smartgroups.com/vault/msofiles
*************************************************************

Other related posts: