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
|
|||
|
|||
Forms and checkboxes
I have a form with one subform.
I would like that, if on the main form the field “open” has the value “0” the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
#2
|
|||
|
|||
Forms and checkboxes
Hi
Set the source of the box on the sub form to =Forms!MainFormName!BoxOnMainFormName -- Wayne Manchester, England. "Amateur" wrote: I have a form with one subform. I would like that, if on the main form the field “open” has the value “0” the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
#3
|
|||
|
|||
Forms and checkboxes
I set the Control source property of the box to the following:
=Forms!billsopenvalue!open But it’s not automatically checked if the value in the field is “0” Do you have any other idea? Thanks Klaus "Wayne-I-M" wrote: Hi Set the source of the box on the sub form to =Forms!MainFormName!BoxOnMainFormName -- Wayne Manchester, England. "Amateur" wrote: I have a form with one subform. I would like that, if on the main form the field “open” has the value “0” the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
#4
|
|||
|
|||
Forms and checkboxes
For text boxes
-1 = Checked 0 = Not checked So if you put 0 in the main form box you will have a non-checked box on the sub form. Sorry but I assume that you are entering either -1 or 0 is this correct. If not a little more info would be helpfull. You could use an AfterUpdate event on the box on the main form to set the value of the box on the sub form or other action but not sure what you're trying to do. -- Wayne Manchester, England. "Amateur" wrote: I set the Control source property of the box to the following: =Forms!billsopenvalue!open But it’s not automatically checked if the value in the field is “0” Do you have any other idea? Thanks Klaus "Wayne-I-M" wrote: Hi Set the source of the box on the sub form to =Forms!MainFormName!BoxOnMainFormName -- Wayne Manchester, England. "Amateur" wrote: I have a form with one subform. I would like that, if on the main form the field “open” has the value “0” the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
#5
|
|||
|
|||
Forms and checkboxes
Hi Wayne
The main form field "open" is a result field from a query. If this field has a positiv value the checkbox on the subform should be unchecked. If the main form field "open" is showing the value "0" , the checkbox should be checked. So, to use your explanation: -1 = Checked 0 = Checked +1 = not checked Maybe this explanation helps a bid. Thanks Klaus "Wayne-I-M" wrote: For text boxes -1 = Checked 0 = Not checked So if you put 0 in the main form box you will have a non-checked box on the sub form. Sorry but I assume that you are entering either -1 or 0 is this correct. If not a little more info would be helpfull. You could use an AfterUpdate event on the box on the main form to set the value of the box on the sub form or other action but not sure what you're trying to do. -- Wayne Manchester, England. "Amateur" wrote: I set the Control source property of the box to the following: =Forms!billsopenvalue!open But it’s not automatically checked if the value in the field is “0” Do you have any other idea? Thanks Klaus "Wayne-I-M" wrote: Hi Set the source of the box on the sub form to =Forms!MainFormName!BoxOnMainFormName -- Wayne Manchester, England. "Amateur" wrote: I have a form with one subform. I would like that, if on the main form the field “open” has the value “0” the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
#6
|
|||
|
|||
Forms and checkboxes
Private Sub open_AfterUpdate()
If (Forms!MainFormName!open 0) Then Me.SubFormName.SetFocus Forms!MainFormName!SubFormName.Form!BoxOnSubFormNa me = -1 End If End Sub Change - MainFormName SubFormName BoxOnSubFormName to what they really are. Note I have used Set Focus to enable to value to be set in the subform so leave that there. Hope this helps -- Wayne Manchester, England. "Amateur" wrote: Hi Wayne The main form field "open" is a result field from a query. If this field has a positiv value the checkbox on the subform should be unchecked. If the main form field "open" is showing the value "0" , the checkbox should be checked. So, to use your explanation: -1 = Checked 0 = Checked +1 = not checked Maybe this explanation helps a bid. Thanks Klaus "Wayne-I-M" wrote: For text boxes -1 = Checked 0 = Not checked So if you put 0 in the main form box you will have a non-checked box on the sub form. Sorry but I assume that you are entering either -1 or 0 is this correct. If not a little more info would be helpfull. You could use an AfterUpdate event on the box on the main form to set the value of the box on the sub form or other action but not sure what you're trying to do. -- Wayne Manchester, England. "Amateur" wrote: I set the Control source property of the box to the following: =Forms!billsopenvalue!open But it’s not automatically checked if the value in the field is “0” Do you have any other idea? Thanks Klaus "Wayne-I-M" wrote: Hi Set the source of the box on the sub form to =Forms!MainFormName!BoxOnMainFormName -- Wayne Manchester, England. "Amateur" wrote: I have a form with one subform. I would like that, if on the main form the field “open” has the value “0” the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
#7
|
|||
|
|||
Forms and checkboxes
Dear Wayne I've tried your code in the afterUpdate in in the sub-form as well
as in the main form. Both trials are not bringing any result. I have the following code If (Forms!billsopenvalue!open 0) Then Me.paidbillshelp.SetFocus Forms!billsopenvalue!paidbillshelp.Form!open = -1 End If Do you have another solution? Klaus "Wayne-I-M" wrote: Private Sub open_AfterUpdate() If (Forms!MainFormName!open 0) Then Me.SubFormName.SetFocus Forms!MainFormName!SubFormName.Form!BoxOnSubFormNa me = -1 End If End Sub Change - MainFormName SubFormName BoxOnSubFormName to what they really are. Note I have used Set Focus to enable to value to be set in the subform so leave that there. Hope this helps -- Wayne Manchester, England. "Amateur" wrote: Hi Wayne The main form field "open" is a result field from a query. If this field has a positiv value the checkbox on the subform should be unchecked. If the main form field "open" is showing the value "0" , the checkbox should be checked. So, to use your explanation: -1 = Checked 0 = Checked +1 = not checked Maybe this explanation helps a bid. Thanks Klaus "Wayne-I-M" wrote: For text boxes -1 = Checked 0 = Not checked So if you put 0 in the main form box you will have a non-checked box on the sub form. Sorry but I assume that you are entering either -1 or 0 is this correct. If not a little more info would be helpfull. You could use an AfterUpdate event on the box on the main form to set the value of the box on the sub form or other action but not sure what you're trying to do. -- Wayne Manchester, England. "Amateur" wrote: I set the Control source property of the box to the following: =Forms!billsopenvalue!open But it’s not automatically checked if the value in the field is “0” Do you have any other idea? Thanks Klaus "Wayne-I-M" wrote: Hi Set the source of the box on the sub form to =Forms!MainFormName!BoxOnMainFormName -- Wayne Manchester, England. "Amateur" wrote: I have a form with one subform. I would like that, if on the main form the field “open” has the value “0” the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
#8
|
|||
|
|||
Forms and checkboxes
Having briefly scaned your code
your problem 'may' lie in your syntax Forms!MainFormName!SubFormName.Form!BoxOnSubFormNa me = -1 does not equal Forms!billsopenvalue!paidbillshelp.Form!open = -1 main problem in your code is you are using the subform syntax to referto a control on your main form. then again I might be totally wrong "Amateur" wrote: Dear Wayne I've tried your code in the afterUpdate in in the sub-form as well as in the main form. Both trials are not bringing any result. I have the following code If (Forms!billsopenvalue!open 0) Then Me.paidbillshelp.SetFocus Forms!billsopenvalue!paidbillshelp.Form!open = -1 End If Do you have another solution? Klaus "Wayne-I-M" wrote: Private Sub open_AfterUpdate() If (Forms!MainFormName!open 0) Then Me.SubFormName.SetFocus Forms!MainFormName!SubFormName.Form!BoxOnSubFormNa me = -1 End If End Sub Change - MainFormName SubFormName BoxOnSubFormName to what they really are. Note I have used Set Focus to enable to value to be set in the subform so leave that there. Hope this helps -- Wayne Manchester, England. "Amateur" wrote: Hi Wayne The main form field "open" is a result field from a query. If this field has a positiv value the checkbox on the subform should be unchecked. If the main form field "open" is showing the value "0" , the checkbox should be checked. So, to use your explanation: -1 = Checked 0 = Checked +1 = not checked Maybe this explanation helps a bid. Thanks Klaus "Wayne-I-M" wrote: For text boxes -1 = Checked 0 = Not checked So if you put 0 in the main form box you will have a non-checked box on the sub form. Sorry but I assume that you are entering either -1 or 0 is this correct. If not a little more info would be helpfull. You could use an AfterUpdate event on the box on the main form to set the value of the box on the sub form or other action but not sure what you're trying to do. -- Wayne Manchester, England. "Amateur" wrote: I set the Control source property of the box to the following: =Forms!billsopenvalue!open But it’s not automatically checked if the value in the field is “0” Do you have any other idea? Thanks Klaus "Wayne-I-M" wrote: Hi Set the source of the box on the sub form to =Forms!MainFormName!BoxOnMainFormName -- Wayne Manchester, England. "Amateur" wrote: I have a form with one subform. I would like that, if on the main form the field “open” has the value “0” the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
#9
|
|||
|
|||
Forms and checkboxes
Steve is right
you have written the code wrong. It should be Forms!billsopenvalue!paidbillshelp.Form!NameOfBoxO nSubForm = -1 "NameOfBoxOnSubForm" needs changing to what it is You place this code on the AfterUpdate of the control called "open" on the main form. Delete all code from the subform check box. The control source of this check box is the field in the table where you want to store the data (0 or -1) -- Wayne Manchester, England. "Amateur" wrote: Dear Wayne I've tried your code in the afterUpdate in in the sub-form as well as in the main form. Both trials are not bringing any result. I have the following code If (Forms!billsopenvalue!open 0) Then Me.paidbillshelp.SetFocus Forms!billsopenvalue!paidbillshelp.Form!open = -1 End If Do you have another solution? Klaus "Wayne-I-M" wrote: Private Sub open_AfterUpdate() If (Forms!MainFormName!open 0) Then Me.SubFormName.SetFocus Forms!MainFormName!SubFormName.Form!BoxOnSubFormNa me = -1 End If End Sub Change - MainFormName SubFormName BoxOnSubFormName to what they really are. Note I have used Set Focus to enable to value to be set in the subform so leave that there. Hope this helps -- Wayne Manchester, England. "Amateur" wrote: Hi Wayne The main form field "open" is a result field from a query. If this field has a positiv value the checkbox on the subform should be unchecked. If the main form field "open" is showing the value "0" , the checkbox should be checked. So, to use your explanation: -1 = Checked 0 = Checked +1 = not checked Maybe this explanation helps a bid. Thanks Klaus "Wayne-I-M" wrote: For text boxes -1 = Checked 0 = Not checked So if you put 0 in the main form box you will have a non-checked box on the sub form. Sorry but I assume that you are entering either -1 or 0 is this correct. If not a little more info would be helpfull. You could use an AfterUpdate event on the box on the main form to set the value of the box on the sub form or other action but not sure what you're trying to do. -- Wayne Manchester, England. "Amateur" wrote: I set the Control source property of the box to the following: =Forms!billsopenvalue!open But it’s not automatically checked if the value in the field is “0” Do you have any other idea? Thanks Klaus "Wayne-I-M" wrote: Hi Set the source of the box on the sub form to =Forms!MainFormName!BoxOnMainFormName -- Wayne Manchester, England. "Amateur" wrote: I have a form with one subform. I would like that, if on the main form the field “open” has the value “0” the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
#10
|
|||
|
|||
Forms and checkboxes
Note that the code is for open, which in this context is the name of the
control bound to the [Open] field. The field and the text box should have different names so that both you and Access are less likely to be confused. If the field is named [Open], try something like txtOpen as the text box name. Another point is that Open is a reserved word in Jet (the database engine underlying the user interface of the Access programs you create). The use of reserved words for field and control names should be avoided. However, if they are used they should be in square brackets. If you use txtOpen as the name of the text box bound to the [Open] field, then the After Update event for the *text box* would look something like this: Private Sub txtOpen_AfterUpdate() If Me.[Open] 0 Then Me.SubFormName.SetFocus Forms!BillsOpenValue!PaidBillsHelp.Form![txtOpen] = -1 End If End Sub The code should work in the form's After Update event as well, and several other places such as the subform control's Enter event. Note that when referencing a control (or property) on the active form, you don't need to use the Forms!etc. syntax. That is to say, your main form's record source includes the field Open, and txtOpen is on the main form, so you can use the Me.txtOpen syntax. The long syntax should work, but it is not necessary. The subform is a separate object, so you need the longer syntax when referencing it from another form (the main form). "Amateur" wrote in message news Dear Wayne I've tried your code in the afterUpdate in in the sub-form as well as in the main form. Both trials are not bringing any result. I have the following code If (Forms!billsopenvalue!open 0) Then Me.paidbillshelp.SetFocus Forms!billsopenvalue!paidbillshelp.Form!open = -1 End If Do you have another solution? Klaus "Wayne-I-M" wrote: Private Sub open_AfterUpdate() If (Forms!MainFormName!open 0) Then Me.SubFormName.SetFocus Forms!MainFormName!SubFormName.Form!BoxOnSubFormNa me = -1 End If End Sub Change - MainFormName SubFormName BoxOnSubFormName to what they really are. Note I have used Set Focus to enable to value to be set in the subform so leave that there. Hope this helps -- Wayne Manchester, England. "Amateur" wrote: Hi Wayne The main form field "open" is a result field from a query. If this field has a positiv value the checkbox on the subform should be unchecked. If the main form field "open" is showing the value "0" , the checkbox should be checked. So, to use your explanation: -1 = Checked 0 = Checked +1 = not checked Maybe this explanation helps a bid. Thanks Klaus "Wayne-I-M" wrote: For text boxes -1 = Checked 0 = Not checked So if you put 0 in the main form box you will have a non-checked box on the sub form. Sorry but I assume that you are entering either -1 or 0 is this correct. If not a little more info would be helpfull. You could use an AfterUpdate event on the box on the main form to set the value of the box on the sub form or other action but not sure what you're trying to do. -- Wayne Manchester, England. "Amateur" wrote: I set the Control source property of the box to the following: =Forms!billsopenvalue!open But it's not automatically checked if the value in the field is "0" Do you have any other idea? Thanks Klaus "Wayne-I-M" wrote: Hi Set the source of the box on the sub form to =Forms!MainFormName!BoxOnMainFormName -- Wayne Manchester, England. "Amateur" wrote: I have a form with one subform. I would like that, if on the main form the field "open" has the value "0" the checkbox on the subform gets automatically checked. Is that possible and if, how? Thanks Klaus |
|
Thread Tools | |
Display Modes | |
|
|