From: Bateman28 on 13 Apr 2010 08:47 Hi hope someone can help I have a form with lots of differnt tickbox options. What i want to do is have a routine so that when two options are ticked Or to the value true, a specific field then becomes ticked. The code i have tried is below, Any help would be greatly appreciated If Me.***CampaignMail = -1 And Me.***vice = -1 Then Me.*****Booking = -1 Else Me.*****Booking = 0 End If The Stars represent letters!
From: Daryl S on 13 Apr 2010 09:29 Bateman28 - The code looks OK, where did you put it (e.g. what events make the code run)? Have you stepped through it? I assume the three fields are boolean (Yes/No) datatypes? You may want code like this in a form subroutine that can be called from several events depending on when you want the validation / updates to take place. Then you can put the call to the subroutine behind the click events of any of the check boxes and maybe on the form's OnCurrent event, and probably on the form's BeforeUpdate event. -- Daryl S "Bateman28" wrote: > Hi hope someone can help > > I have a form with lots of differnt tickbox options. What i want to do is > have a routine so that when two options are ticked Or to the value true, a > specific field then becomes ticked. The code i have tried is below, Any help > would be greatly appreciated > > If Me.***CampaignMail = -1 And Me.***vice = -1 Then > Me.*****Booking = -1 > Else > Me.*****Booking = 0 > End If > > The Stars represent letters!
From: Bateman28 on 13 Apr 2010 11:03 The code has been applied to the "After Update" command, and yes the fields are tick boxes as boolean....Any other idea's?? "Daryl S" wrote: > Bateman28 - > > The code looks OK, where did you put it (e.g. what events make the code > run)? Have you stepped through it? I assume the three fields are boolean > (Yes/No) datatypes? > > You may want code like this in a form subroutine that can be called from > several events depending on when you want the validation / updates to take > place. Then you can put the call to the subroutine behind the click events > of any of the check boxes and maybe on the form's OnCurrent event, and > probably on the form's BeforeUpdate event. > > -- > Daryl S > > > "Bateman28" wrote: > > > Hi hope someone can help > > > > I have a form with lots of differnt tickbox options. What i want to do is > > have a routine so that when two options are ticked Or to the value true, a > > specific field then becomes ticked. The code i have tried is below, Any help > > would be greatly appreciated > > > > If Me.***CampaignMail = -1 And Me.***vice = -1 Then > > Me.*****Booking = -1 > > Else > > Me.*****Booking = 0 > > End If > > > > The Stars represent letters!
From: Amy E. Baggott on 13 Apr 2010 11:44 You might want to replace -1 and 0 with True and False since they are boolean values. Also, is it in the AfterUpdate property of the form or of one of the fields? -- Amy E. Baggott "I''m going crazy and I''m taking all of you with me!" -- Linda Grayson "Bateman28" wrote: > The code has been applied to the "After Update" command, and yes the fields > are tick boxes as boolean....Any other idea's?? > > "Daryl S" wrote: > > > Bateman28 - > > > > The code looks OK, where did you put it (e.g. what events make the code > > run)? Have you stepped through it? I assume the three fields are boolean > > (Yes/No) datatypes? > > > > You may want code like this in a form subroutine that can be called from > > several events depending on when you want the validation / updates to take > > place. Then you can put the call to the subroutine behind the click events > > of any of the check boxes and maybe on the form's OnCurrent event, and > > probably on the form's BeforeUpdate event. > > > > -- > > Daryl S > > > > > > "Bateman28" wrote: > > > > > Hi hope someone can help > > > > > > I have a form with lots of differnt tickbox options. What i want to do is > > > have a routine so that when two options are ticked Or to the value true, a > > > specific field then becomes ticked. The code i have tried is below, Any help > > > would be greatly appreciated > > > > > > If Me.***CampaignMail = -1 And Me.***vice = -1 Then > > > Me.*****Booking = -1 > > > Else > > > Me.*****Booking = 0 > > > End If > > > > > > The Stars represent letters!
From: Bateman28 on 13 Apr 2010 12:08 Hi thanks for the reply, The "After Update" is on the field that contains the first part of code within my form. I have also tried to use the code with "True & False" values rather than "-1 Or 0's"! I Tried Another way like shown below but that didnt work either! Arrrrrrrrr! Any more idea's would be greatly appreciated! Private Sub ***CampaignMail_AfterUpdate() If Me![***CampaignMail] = -1 And Me![Service] = -1 Then Me![*****Booking] = -1 Else Me![*****Booking] = 0 End If End Sub "Amy E. Baggott" wrote: > You might want to replace -1 and 0 with True and False since they are boolean > values. Also, is it in the AfterUpdate property of the form or of one of the > fields? > > -- > Amy E. Baggott > > "I''m going crazy and I''m taking all of you with me!" -- Linda Grayson > > > "Bateman28" wrote: > > > The code has been applied to the "After Update" command, and yes the fields > > are tick boxes as boolean....Any other idea's?? > > > > "Daryl S" wrote: > > > > > Bateman28 - > > > > > > The code looks OK, where did you put it (e.g. what events make the code > > > run)? Have you stepped through it? I assume the three fields are boolean > > > (Yes/No) datatypes? > > > > > > You may want code like this in a form subroutine that can be called from > > > several events depending on when you want the validation / updates to take > > > place. Then you can put the call to the subroutine behind the click events > > > of any of the check boxes and maybe on the form's OnCurrent event, and > > > probably on the form's BeforeUpdate event. > > > > > > -- > > > Daryl S > > > > > > > > > "Bateman28" wrote: > > > > > > > Hi hope someone can help > > > > > > > > I have a form with lots of differnt tickbox options. What i want to do is > > > > have a routine so that when two options are ticked Or to the value true, a > > > > specific field then becomes ticked. The code i have tried is below, Any help > > > > would be greatly appreciated > > > > > > > > If Me.***CampaignMail = -1 And Me.***vice = -1 Then > > > > Me.*****Booking = -1 > > > > Else > > > > Me.*****Booking = 0 > > > > End If > > > > > > > > The Stars represent letters!
|
Next
|
Last
Pages: 1 2 Prev: Problems adding new record from form / subform Next: COMMAND BUTTON CAPTION |