Hello,
I'm trying to add some data validation to the BeforeUpdate event of a
form. I want the user to select a number between 1 and 3 for the
[Choice] field. Can I use something like IsNot? Sorry, a little
rusty here!
Thanks
=====================
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Data validation to ensure a choice number between 1 and 3 is
selected.
If IsNot (Me.Choice (>=1 And <=3) Then
MsgBox "Please select a choice number between 1 and 3.."
DoCmd.CancelEvent
Me.Choice.SetFocus
End If 4 1650
"WPW07" <ww********@gmail.comwrote in message
news:54**********************************@8g2000hs e.googlegroups.com...
Hello,
I'm trying to add some data validation to the BeforeUpdate event of a
form. I want the user to select a number between 1 and 3 for the
[Choice] field. Can I use something like IsNot? Sorry, a little
rusty here!
Thanks
=====================
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Data validation to ensure a choice number between 1 and 3 is
selected.
If IsNot (Me.Choice (>=1 And <=3) Then
MsgBox "Please select a choice number between 1 and 3.."
DoCmd.CancelEvent
Me.Choice.SetFocus
End If
Replace IsNot with Not
iif(not (True),"Not False","Not True")
On Mar 14, 3:39*pm, "paii, Ron" <n...@no.comwrote:
"WPW07" <wwisnie...@gmail.comwrote in message
news:54**********************************@8g2000hs e.googlegroups.com...
Hello,
I'm trying to add some data validation to the BeforeUpdate event of a
form. *I want the user to select a number between 1 and 3 for the
[Choice] field. * Can I use something like IsNot? *Sorry, a little
rusty here!
Thanks
=====================
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Data validation to ensure a choice number between 1 and 3 is
selected.
* If IsNot (Me.Choice (>=1 And <=3) Then
* * * * *MsgBox "Please select a choice number between 1 and 3..."
* * * * *DoCmd.CancelEvent
* * * * *Me.Choice.SetFocus
*End If
Replace IsNot with Not
*iif(not (True),"Not False","Not True")- Hide quoted text -
- Show quoted text -
Why not use Me.Choice as a combo Box. Make it so that you cant type
anything there in KeyPress method : AcsiiCode = 0. And have the
options available obviosly having a default option.
- GL
On Mar 14, 3:49 pm, Guillermo_Lopez <g.lo...@iesdr.comwrote:
On Mar 14, 3:39 pm, "paii, Ron" <n...@no.comwrote:
"WPW07" <wwisnie...@gmail.comwrote in message
news:54**********************************@8g2000hs e.googlegroups.com...
Hello,
I'm trying to add some data validation to the BeforeUpdate event of a
form. I want the user to select a number between 1 and 3 for the
[Choice] field. Can I use something like IsNot? Sorry, a little
rusty here!
Thanks
=====================
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Data validation to ensure a choice number between 1 and 3 is
selected.
If IsNot (Me.Choice (>=1 And <=3) Then
MsgBox "Please select a choice number between 1 and 3.."
DoCmd.CancelEvent
Me.Choice.SetFocus
End If
Replace IsNot with Not
iif(not (True),"Not False","Not True")- Hide quoted text -
- Show quoted text -
Why not use Me.Choice as a combo Box. Make it so that you cant type
anything there in KeyPress method : AcsiiCode = 0. And have the
options available obviosly having a default option.
- GL
Whoa, forgot about limit to list in a combo box. I'll use that.
Thanks for your help!
WPW07 wrote:
Hello,
I'm trying to add some data validation to the BeforeUpdate event of a
form. I want the user to select a number between 1 and 3 for the
[Choice] field. Can I use something like IsNot? Sorry, a little
rusty here!
Thanks
=====================
Private Sub Form_BeforeUpdate(Cancel As Integer)
'Data validation to ensure a choice number between 1 and 3 is
selected.
If IsNot (Me.Choice (>=1 And <=3) Then
MsgBox "Please select a choice number between 1 and 3.."
DoCmd.CancelEvent
Me.Choice.SetFocus
End If
Not that I know off.
If (Me.Choice <1 Or Me.Choice >3) then
or
If Instr("123",Me.Choice) = 0 then
would work.
BTW, most folks would use
Cancel = True
instead of
DoCmd.CancelEvent
Naike http://www.youtube.com/watch?v=0VmhcBbfsp0 This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Mudge |
last post by:
Please, someone, tell me why OO in PHP is better than procedural.
|
by: bigoxygen |
last post by:
Hi.
I'm using a 3 tier FrontController Design for my web application right
now.
The problem is that I'm finding to have to duplicate a lot of code for
similar functions; for example, listing...
|
by: jason |
last post by:
Hello.
Newbie on SQL and suffering through this.
I have two tables created as such:
drop table table1;
go
drop table table2;
go
|
by: Dario de Judicibus |
last post by:
I'm getting crazy. Look at this code:
#include <string.h>
#include <stdio.h>
#include <iostream.h>
using namespace std ;
char ini_code = {0xFF, 0xFE} ;
char line_sep = {0x20, 0x28} ;
|
by: Andrew Thompson |
last post by:
It seems most people get there JS off web sites, which is
entirely logical. But it is also a great pity since most
of that code is of such poor quality.
I was looking through the JS FAQ for any...
| |
by: ED |
last post by:
I currently have vba code that ranks employees based on their average
job time ordered by their region, zone, and job code. I currently
have vba code that will cycle through a query and ranks each...
|
by: Namratha Shah \(Nasha\) |
last post by:
Hey Guys,
Today we are going to look at Code Access Security.
Code access security is a feature of .NET that manages code depending on its
trust level. If the CLS trusts the code enough to...
|
by: Joe Fallon |
last post by:
I have some complex logic which is fairly simply to build up into a string.
I needed a way to Eval this string and return a Boolean result.
This code works fine to achieve that goal.
My...
|
by: Alan Silver |
last post by:
Hello,
Newbie here, so please forgive what is probably a basic question ...
I see a lot of discussion about "code behind", which if I have
understood correctly, means that the script code goes...
|
by: tshad |
last post by:
I am just trying to decide whether to split my code and uses code behind. I
did it with one of my pages and found it was quite a bit of trouble.
I know that most people (and books and articles)...
|
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,...
| |
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...
|
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...
|
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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |