Rabu, 19 Oktober 2011

RE: [MS_AccessPros] How to show a warning msg, when user leaves a form

 

Dennis-

The form's BeforeUpdate event should do it.

If IsNull (Me.Bransch) Then ...

.. assuming that the second column (column(1)) is the bound column.

John Viescas, author
Microsoft Office Access 2010 Inside Out
Microsoft Office Access 2007 Inside Out
Building Microsoft Access Applications
Microsoft Office Access 2003 Inside Out
SQL Queries for Mere Mortals
http://www.viescas.com/
(Paris, France)

-----Original Message-----
From: MS_Access_Professionals@yahoogroups.com
[mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Dennis Davidsson
Sent: Wednesday, October 19, 2011 5:26 PM
To: MS_Access_Professionals@yahoogroups.com
Subject: Re: [MS_AccessPros] How to show a warning msg, when user leaves a form

John,

I wanted to be sure that the incompletely filled in record could in no way by
mistake be saved into the database containing null in the critical field, a
combo box. I tried around with a few examples, and think the Event property
'Before update' would be the right alternative.
Then however I jumped into next problem: Hoping to test on Null in the combo
box, I wrote a piece of code like this:
'If Me!Bransch.Column(1) is Null Then
MsgBox "warning..."
End If
However, executing this line Access shows an error box saying:
'Object is required.'
I have run the code in single step mode and checked that the value of
Me!Bransch.Column(1) actually is Null.
What am I doing wrong?
Dennis

19 okt 2011 kl. 15:51 skrev John Viescas:

> Dennis-
>
> Is the form bound? (i.e. has a Record Source)
>
> Please explain what you mean by "leave the form." Close it? Move to another
> record? Put the focus on another form?
>
> John Viescas, author
> Microsoft Office Access 2010 Inside Out
> Microsoft Office Access 2007 Inside Out
> Building Microsoft Access Applications
> Microsoft Office Access 2003 Inside Out
> SQL Queries for Mere Mortals
> http://www.viescas.com/
> (Paris, France)
>
> -----Original Message-----
> From: MS_Access_Professionals@yahoogroups.com
> [mailto:MS_Access_Professionals@yahoogroups.com] On Behalf Of Dennis Davidsson
> Sent: Wednesday, October 19, 2011 3:47 PM
> To: MS_Access_Professionals@yahoogroups.com
> Subject: [MS_AccessPros] How to show a warning msg, when user leaves a form
>
> Hello,
>
> I want to show a warning message to the user, if he leaves the active form
> without having filled in all boxes properly, because none of the boxes must be
> left with nulls.
> I assume this can be accomplished by issuing a MsgBox statement in some Event
> Property of the form.
> But which is the relevant Event Property to choose for this, so that it covers
> all possible ways of leaving the form?
>
> Regards
> Dennis Davidsson
>
> [Non-text portions of this message have been removed]
>
> ------------------------------------
>
> Yahoo! Groups Links
>
>

[Non-text portions of this message have been removed]

------------------------------------

Yahoo! Groups Links

__._,_.___
Recent Activity:
MARKETPLACE

Stay on top of your group activity without leaving the page you're on - Get the Yahoo! Toolbar now.

.

__,_._,___

Tidak ada komentar:

Posting Komentar