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 » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Forms and checkboxes



 
 
Thread Tools Display Modes
  #1  
Old May 25th, 2007, 10:10 AM posted to microsoft.public.access
Amateur
external usenet poster
 
Posts: 337
Default 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  
Old May 25th, 2007, 10:54 AM posted to microsoft.public.access
Wayne-I-M
external usenet poster
 
Posts: 3,674
Default 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  
Old May 25th, 2007, 11:04 AM posted to microsoft.public.access
Amateur
external usenet poster
 
Posts: 337
Default 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  
Old May 25th, 2007, 11:12 AM posted to microsoft.public.access
Wayne-I-M
external usenet poster
 
Posts: 3,674
Default 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  
Old May 25th, 2007, 11:23 AM posted to microsoft.public.access
Amateur
external usenet poster
 
Posts: 337
Default 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  
Old May 25th, 2007, 11:47 AM posted to microsoft.public.access
Wayne-I-M
external usenet poster
 
Posts: 3,674
Default 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  
Old May 25th, 2007, 12:13 PM posted to microsoft.public.access
Amateur
external usenet poster
 
Posts: 337
Default 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  
Old May 25th, 2007, 12:28 PM posted to microsoft.public.access
steve_doc
external usenet poster
 
Posts: 68
Default 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  
Old May 25th, 2007, 12:41 PM posted to microsoft.public.access
Wayne-I-M
external usenet poster
 
Posts: 3,674
Default 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  
Old May 25th, 2007, 12:53 PM posted to microsoft.public.access
BruceM[_2_]
external usenet poster
 
Posts: 1,763
Default 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

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:07 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.