I am a newbie using Access 2000.
I am using the following test in the txtAlbum OnExit procedure to prevent
leaving an empty text box for a required field
If (IsNull(txtAlbum.Value)) Or (Len(txtAlbum.Value) < 1) Then
MsgBox("Album Title cannot be empty")
txtAlbum.SetFocus
End If
When the Message Box closes, the focus is on the control clicked on or is on
the next Tab Stop (depending on how I exit the text box.) Why doesn't the
SetFocus method work in this instance? I have event procedures for other
controls (Command Buttons) on my form which include
txtAlbum.SetFocus
that work fine.
Can anyone help me figure out what I am doing wrong? I suspect that the user
action (clicking outside the text box or pressing the Tab key) which initiates
the text box control's On Exit event has it's own Set Focus method that
executes after my statement. In any event I don't know what, if anything, to do
to change this behavior.
Paul Core 4 10168
Hi Paul,
After the MsgBox statement and before the set focus statement add:
Cancel = True
Stewart
"Corepaul" <co******@aol.combvwertz> wrote in message
news:20***************************@mb-m15.aol.com... I am a newbie using Access 2000.
I am using the following test in the txtAlbum OnExit procedure to prevent leaving an empty text box for a required field
If (IsNull(txtAlbum.Value)) Or (Len(txtAlbum.Value) < 1) Then MsgBox("Album Title cannot be empty") txtAlbum.SetFocus End If
When the Message Box closes, the focus is on the control clicked on or is
on the next Tab Stop (depending on how I exit the text box.) Why doesn't the SetFocus method work in this instance? I have event procedures for other controls (Command Buttons) on my form which include
txtAlbum.SetFocus
that work fine.
Can anyone help me figure out what I am doing wrong? I suspect that the
user action (clicking outside the text box or pressing the Tab key) which
initiates the text box control's On Exit event has it's own Set Focus method that executes after my statement. In any event I don't know what, if anything,
to do to change this behavior.
Paul Core
Thanks Stewart, it now works.
I went to the Access help files but am still a little unclear HOW it works.
According to the help file, the Cancel Method applies to three types of
objects, Connection, QueryDef, or Recordset. Can anyone help me understand what
object does this command acts on?
Paul Core
Have a look at the CancelEvent Action in the help file. This lists all the
events that can be canceled.
Stewart
"Corepaul" <co******@aol.combvwertz> wrote in message
news:20***************************@mb-m15.aol.com... Thanks Stewart, it now works.
I went to the Access help files but am still a little unclear HOW it
works. According to the help file, the Cancel Method applies to three types of objects, Connection, QueryDef, or Recordset. Can anyone help me understand
what object does this command acts on?
Paul Core
> I went to the Access help files but am still a little unclear HOW it works. According to the help file, the Cancel Method applies to three types of objects, Connection, QueryDef, or Recordset. Can anyone help me understand
what object does this command acts on?
It is an argument of the event procedure. Some event procedures
(Access-generated procedures) contain a "Cancel" argument, the default value of
which is "False". If you set this value to "True" within the procedure, the
event is cancelled. You can find this in Access Help - search for "event
property" in the "Index" tab of Help, select from the topic list "Events and
Event Properties Reference", then click on the "Exit" event in the pane to the
right, and then, in the resulting page, click on the "Event Procedures"
hyperlink at the top and, since there should only be one item in the dialog
list, simply click on "Display". I know it's a long and confusing haul to get
there, but there are a few weaknesses in Help in later versions.
--
Bruce M. Thompson, Microsoft Access MVP bt******@mvps.org (See the Access FAQ at http://www.mvps.org/access) NO Email Please. Keep all communications
within the newsgroups so that all might benefit.<< This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Marco Bubke |
last post by:
Hi
I have read some mail on the dev mailing list about PEP 318 and find the new
Syntax really ugly.
def foo(x, y): pass
I call this foo(1, 2), this isn't really intuitive to me!
Also I don't like the brackets.
|
by: Anthony Baxter |
last post by:
To go along with the 2.4a3 release, here's an updated version of
the decorator PEP. It describes the state of decorators as they
are in 2.4a3.
PEP: 318
Title: Decorators for Functions and Methods
Version: $Revision: 1.34 $
Last-Modified: $Date: 2004/09/03 09:32:50 $
Author: Kevin D. Smith, Jim Jewett, Skip Montanaro, Anthony Baxter
|
by: Alex Nordhus |
last post by:
I need some help. I cant seem to get rid of this error.
I can program a button that will exit the program and remove the icon in
the taskbar, but I have to tie it to OnTaskBarClose.
OnExit and OnCloseWindow do nothing and leave the icon in the taskbar, I
think I have tried every option, when you double click the icon it gives
you the...
|
by: arun venkatesan |
last post by:
Hi,
We use a TListView component in C++ Builder to enable the user make
some selections. When the user makes a selection, the selected rows
are highlighted in 'Blue'.
Now, my application is such that the user can use the 'Tab' key to
move to different components on his screen, after making the
selection. When he does so, the 'Blue' color...
|
by: David Mitchell |
last post by:
I have a form (frmAcq) which the user enters details of goods received
including the total number of items received. The form has a subform
(sfmAcqDetail) in which the user enters a breakdown of products
received, their price, quantity etc.
I have set the on exit event to check if the sum of the quantity field
on the sub form matches the...
| |
by: swingingming |
last post by:
Hi, in the NorthWind sample database, when clicking on the next
navigation button on the new order record with nothing on the subform
(order details), we got an order with nothing ordered. How can we
prevent this from happening?
Thanks.
ming
|
by: T Conti |
last post by:
Hello:
I created a basic windows service that polls a db and sends emails to
our subscribers. In the onstart method I create a new thread and send
it on its way to do work. It should never end unless told to do so by
the onexit event I implemented in the worker object. However there
are the rare circumstance that the thread hits a...
|
by: ern |
last post by:
Right now I'm using exit(0) to terminate my program. My
program is a console .exe application. After the "exit(0)" line of
code is encountered, the console application waits for an enter press,
before terminating. I want it to terminate completely without having
to press enter manually. Anybody know what I might be missing here ?
|
by: brucedodds |
last post by:
I have an Access 2003 form bound to a SQL Server table via ODBC.
Often clicking a button on the form has the effect of requerying the
form rather than firing the OnClick event. Does anyone have an
explanation? Is this evidence of corruption, or a known side effect?
TIA
Bruce
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it. ...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert...
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |