OK, can the MsgBox. Put two command buttons on your form - "Yes" and "No."
Put the No button first in the tab order and set its Default property to Yes
- that will cause the "No" button to be "clicked" if the user just
absent-mindedly presses Enter. Behind the No button, just close the form.
Behind the Yes button, do the backup. Forget about trying to "dirty" an
unbound text box on the form.
John Viescas, author
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
Running Microsoft Access 2000
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
For the inside scoop on Access 2007, see:
http://blogs.msdn.com/access/
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On Behalf
Of Ilona Wright
Sent: Thursday, May 11, 2006 1:29 PM
To: [email protected]
Subject: RE: [ms_access] Default Value/Event Procedure Help
Hi John,
I still have problems.
What I want to do is run an update query over a table but before the user
selects to update, I want a form to load asking the user if they backed up
their data. In my form I have a large label, with red text on a yellow
background asking the user if they have backed up.
I then want the message box to display next to this label. There are no
other controls on the form. If the response to the MsgBox is OK, the update
goes ahead, if it is anything else (No or Cancel) I want the form to close.
If I change from design view to form view I had the form display and the
MsgBox. I have forgotten what event procedure I had this in, I have moved
the code around so much. Then if I opened the form from database view, I
only got the MsgBox without the form displaying.
Then moving the MsgBox code between the various events to see which one
worked I mostly got a message telling me that I cannot close a form in this
event.
Can you please help me again.
Your suggestion re the "dirtird" control did not work.
Is the fact that I am using ACCESS 97 causing me a problem?
I have looked in the Northwind Solutions databse, but cannot find anything
similay.
Thank you
Ilona
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED]
Behalf Of John Viescas
Sent: Wednesday, 10 May 2006 4:30 PM
To: [email protected]
Subject: RE: [ms_access] Default Value/Event Procedure Help
Ilona-
Instead of defining the default value, set the value to "N" in the Load
event and place the focus there. I believe AfterUpdate will fire if the
user presses Enter because you have "dirtied" the control.
But what is it you're trying to do? Get the user to make a decision with
a
default of "no?" If so, a MsgBox is much cleaner:
If vbYes = MsgBox("Are you sure you want to do this?", _
vbQuestion + vbYesNo = vbDefaultButton2) Then
The above displays a message box dialog with Yes and No buttons, a
question
mark icon, and the second button (the NO) set as the default. If the user
just presses Enter, the answer back will be vbNo. If the user tabs to the
other button or clicks it, the answer will be vbYes.
John Viescas, author
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
Running Microsoft Access 2000
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)
For the inside scoop on Access 2007, see:
http://blogs.msdn.com/access/
-----Original Message-----
From: [email protected] [mailto:[EMAIL PROTECTED] On
Behalf
Of Ilona Wright
Sent: Wednesday, May 10, 2006 7:32 AM
To: [email protected]
Subject: RE: [ms_access] Default Value/Event Procedure Help
Hi there,
I have an unbound text box in a form which is to store a user response of
"Y" or "N".
I have set the default value as "N".
I want the form to close if the user keys "N" followed by the Enter key,
or
if the user presses just the Enter Key.
If I press "N" followed by the Enter key, I can get the form to close in
the
AfterUpdate event procedure.
But
If I just accept the default value by pressing the Enter key only without
keying N first, the AfterUpdate event procedure does not process.
By having MsgBoxes display at each event I discovered that pressing Enter
only, causes the On Exit event procedure to run.
But if I try to close the form in the On Exit event procedure I get an
error
message
"This action can't be carried out while processing a form or report event.
A macro specified as the OnOpen, OnClose, OnFormat, Onretreat, OnPage, or
Onprint property setting contains an invalid action for the property.
When you click OK, an Action failed dialogue box will display the name of
the macro that failed and its arguments."
And it is the close form that displays.
Am I having this problem because the text box is an unbound control?
How do I get this to work? I could use command buttons but I do not want
to
in this instance?
Can you help me please?
Thank you very much
Ilona
Adelaide, Australia
[Non-text portions of this message have been removed]
Yahoo! Groups Links
SPONSORED LINKS Microsoft access database Database development software
Database management software
Database software Inventory database software Membership database
software
----------------------------------------------------------------------------
--
YAHOO! GROUPS LINKS
a.. Visit your group "ms_access" on the web.
b.. To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
c.. Your use of Yahoo! Groups is subject to the Yahoo! Terms of
Service.
----------------------------------------------------------------------------
--
[Non-text portions of this message have been removed]
Yahoo! Groups Links
SPONSORED LINKS
| Microsoft access database | Database development software | Database management software |
| Database software | Inventory database software | Membership database software |
YAHOO! GROUPS LINKS
- Visit your group "ms_access" on the web.
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
