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. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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
|
|||
|
|||
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 |
Thread Tools | |
Display Modes | |
|
|