A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Access » Using Forms
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Access 2000 AfterUpdate with a Iff



 
 
Thread Tools Display Modes
  #1  
Old November 2nd, 2006, 11:53 AM posted to microsoft.public.access.forms
Céline Brien
external usenet poster
 
Posts: 62
Default Access 2000 AfterUpdate with a Iff

Hi everybody,
In a form, when I select the departement of the employee, if the number of
the departement is a certain number, I would like to check a box in another
field.
Something like that :
--------------------------------------
Private Sub NoDepartement_AfterUpdate()
Iff Me.NoDepartement 153 and 171
Me.Good = Vrai
End Sub
--------------------------------------
Thank you for your help,
Céline


  #2  
Old November 2nd, 2006, 12:39 PM posted to microsoft.public.access.forms
Céline Brien
external usenet poster
 
Posts: 62
Default Access 2000 AfterUpdate with a Iff

Hi everybody,
I found the answer.
I used a Case statement.
Have a good day !
Céline
-----------------------------------
Select Case NoDepartement
Case 154
Me.Good = -1
Case 155
Me.Good = -1
...

Else
Me.Good = 0
End Select


Exact coding may be slightly different. This is air code from the top of my
head.


"Céline Brien" a écrit dans le message de
news: ...
Hi everybody,
In a form, when I select the departement of the employee, if the number of
the departement is a certain number, I would like to check a box in
another field.
Something like that :
--------------------------------------
Private Sub NoDepartement_AfterUpdate()
Iff Me.NoDepartement 153 and 171
Me.Good = Vrai
End Sub
--------------------------------------
Thank you for your help,
Céline



  #3  
Old November 2nd, 2006, 01:58 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Access 2000 AfterUpdate with a Iff

Your first solution is better, but just needs the syntax cleaned up.

If Me.NoDepartement = 154 and = 170 Then
Me.Good = Vrai
End If



"Céline Brien" wrote:

Hi everybody,
I found the answer.
I used a Case statement.
Have a good day !
Céline
-----------------------------------
Select Case NoDepartement
Case 154
Me.Good = -1
Case 155
Me.Good = -1
...

Else
Me.Good = 0
End Select


Exact coding may be slightly different. This is air code from the top of my
head.


"Céline Brien" a écrit dans le message de
news: ...
Hi everybody,
In a form, when I select the departement of the employee, if the number of
the departement is a certain number, I would like to check a box in
another field.
Something like that :
--------------------------------------
Private Sub NoDepartement_AfterUpdate()
Iff Me.NoDepartement 153 and 171
Me.Good = Vrai
End Sub
--------------------------------------
Thank you for your help,
Céline




  #4  
Old November 2nd, 2006, 02:50 PM posted to microsoft.public.access.forms
Douglas J. Steele
external usenet poster
 
Posts: 9,313
Default Access 2000 AfterUpdate with a Iff

Uh uh.

That needs to be:

If Me.NoDepartement = 154 And Me.NoDepartement = 170 Then
Me.Good = Vrai
End If

although I don't see why you changed it from her original

If Me.NoDepartement 153 And Me.NoDepartement 171 Then
Me.Good = Vrai
End If

Alternative, Céline, your Case statement could have been simplified to

Select Case NoDepartement
Case 154 To 170
Me.Good = -1
Else
Me.Good = 0
End Select


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Klatuu" wrote in message
...
Your first solution is better, but just needs the syntax cleaned up.




"Céline Brien" wrote:

Hi everybody,
I found the answer.
I used a Case statement.
Have a good day !
Céline
-----------------------------------
Select Case NoDepartement
Case 154
Me.Good = -1
Case 155
Me.Good = -1
...

Else
Me.Good = 0
End Select


Exact coding may be slightly different. This is air code from the top of
my
head.


"Céline Brien" a écrit dans le message de
news: ...
Hi everybody,
In a form, when I select the departement of the employee, if the number
of
the departement is a certain number, I would like to check a box in
another field.
Something like that :
--------------------------------------
Private Sub NoDepartement_AfterUpdate()
Iff Me.NoDepartement 153 and 171
Me.Good = Vrai
End Sub
--------------------------------------
Thank you for your help,
Céline






  #5  
Old November 2nd, 2006, 03:06 PM posted to microsoft.public.access.forms
Klatuu
external usenet poster
 
Posts: 7,074
Default Access 2000 AfterUpdate with a Iff

doh!
Sorry about that. Don't know what I was thinking.
As to the change, it is just a habit I have. Although both are logically
the same, using the = and = explicitly shows the inclusive range. IMHO,
better self documenting.

"Douglas J. Steele" wrote:

Uh uh.

That needs to be:

If Me.NoDepartement = 154 And Me.NoDepartement = 170 Then
Me.Good = Vrai
End If

although I don't see why you changed it from her original

If Me.NoDepartement 153 And Me.NoDepartement 171 Then
Me.Good = Vrai
End If

Alternative, Céline, your Case statement could have been simplified to

Select Case NoDepartement
Case 154 To 170
Me.Good = -1
Else
Me.Good = 0
End Select


--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)


"Klatuu" wrote in message
...
Your first solution is better, but just needs the syntax cleaned up.




"Céline Brien" wrote:

Hi everybody,
I found the answer.
I used a Case statement.
Have a good day !
Céline
-----------------------------------
Select Case NoDepartement
Case 154
Me.Good = -1
Case 155
Me.Good = -1
...

Else
Me.Good = 0
End Select


Exact coding may be slightly different. This is air code from the top of
my
head.


"Céline Brien" a écrit dans le message de
news: ...
Hi everybody,
In a form, when I select the departement of the employee, if the number
of
the departement is a certain number, I would like to check a box in
another field.
Something like that :
--------------------------------------
Private Sub NoDepartement_AfterUpdate()
Iff Me.NoDepartement 153 and 171
Me.Good = Vrai
End Sub
--------------------------------------
Thank you for your help,
Céline







  #6  
Old November 3rd, 2006, 03:04 PM posted to microsoft.public.access.forms
Céline Brien
external usenet poster
 
Posts: 62
Default Access 2000 AfterUpdate with a Iff

Hi everybody,
Hi Klatuu,
Hi Douglas,
Thank you so much for your answer.
If Me.NoDepartement = 154 And Me.NoDepartement = 170 Then
Me.Good = Vrai
End If
I was close ! But with computer, close is not enough...
Have a good day !
Céline

"Klatuu" a écrit dans le message de news:
...
Your first solution is better, but just needs the syntax cleaned up.

If Me.NoDepartement = 154 and = 170 Then
Me.Good = Vrai
End If



"Céline Brien" wrote:

Hi everybody,
I found the answer.
I used a Case statement.
Have a good day !
Céline
-----------------------------------
Select Case NoDepartement
Case 154
Me.Good = -1
Case 155
Me.Good = -1
...

Else
Me.Good = 0
End Select


Exact coding may be slightly different. This is air code from the top of
my
head.


"Céline Brien" a écrit dans le message de
news: ...
Hi everybody,
In a form, when I select the departement of the employee, if the number
of
the departement is a certain number, I would like to check a box in
another field.
Something like that :
--------------------------------------
Private Sub NoDepartement_AfterUpdate()
Iff Me.NoDepartement 153 and 171
Me.Good = Vrai
End Sub
--------------------------------------
Thank you for your help,
Céline






 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 09:30 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.