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  

Group checkboxes on subform



 
 
Thread Tools Display Modes
  #1  
Old November 27th, 2009, 03:14 PM posted to microsoft.public.access.forms
Yara
external usenet poster
 
Posts: 19
Default Group checkboxes on subform

Hello,

I am creating a form that has two fields on it that are linked to a table.
When I click one of the fields a subform opens. On this subform I have
created a group of 9 checkboxes (like a matrix). If the first checkbox is
checked, I want the value "T" to be entered in the first field of the
mainform and the value "W" to be entered in the second field of the mainform
then the subform should close. If the secondbox is checked then different
values should be entered in the feld and so on.

I suspect that I need to write a procedure in the propertiesfield on key
press of the first checkbox and do the same with the other checkboxes. But I
don't know the code. Can anyone help me? The name of the mainform =
FrmOverzicht, the name of field 1 on the mainform = info and field 2 = NNW.

Thanks in advance,
Yara
  #2  
Old November 27th, 2009, 10:19 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Group checkboxes on subform

You can put code like this on the after update of the checkbox.

Private Sub Check1_AfterUpdate
If Me.Check1 = True Then
Me.Parent.[NameOfControlA] = "T"
Me.Parent.[NameOfControlB] = "W"
DoCmd.Close acForm, Me.Name
End If
End Sub


The above code assumes that the first checkbox is called Check1
Where the code has [NameOfControlA] , replace it with the name of the
control on the main form.
Do similar for [NameOfControlB]

Do a similar thing for the other 8 checkboxes.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Yara" wrote in message
...
Hello,

I am creating a form that has two fields on it that are linked to a table.
When I click one of the fields a subform opens. On this subform I have
created a group of 9 checkboxes (like a matrix). If the first checkbox is
checked, I want the value "T" to be entered in the first field of the
mainform and the value "W" to be entered in the second field of the
mainform
then the subform should close. If the secondbox is checked then different
values should be entered in the feld and so on.

I suspect that I need to write a procedure in the propertiesfield on key
press of the first checkbox and do the same with the other checkboxes. But
I
don't know the code. Can anyone help me? The name of the mainform =
FrmOverzicht, the name of field 1 on the mainform = info and field 2 =
NNW.

Thanks in advance,
Yara



  #3  
Old November 28th, 2009, 02:16 PM posted to microsoft.public.access.forms
Yara
external usenet poster
 
Posts: 19
Default Group checkboxes on subform

Hi Jeanette,

Thank you for the code. It works fine with checkboxes. Is there anyway I can
use this on a selection button (Sorry I have the Dutch version and I don't
know the english name for this). There is no after update there. Where can I
put it then. I have tried to place the code at key press but that doen't
work. Can you plese help me again?

Kind regards,
Yara

"Jeanette Cunningham" wrote:

You can put code like this on the after update of the checkbox.

Private Sub Check1_AfterUpdate
If Me.Check1 = True Then
Me.Parent.[NameOfControlA] = "T"
Me.Parent.[NameOfControlB] = "W"
DoCmd.Close acForm, Me.Name
End If
End Sub


The above code assumes that the first checkbox is called Check1
Where the code has [NameOfControlA] , replace it with the name of the
control on the main form.
Do similar for [NameOfControlB]

Do a similar thing for the other 8 checkboxes.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Yara" wrote in message
...
Hello,

I am creating a form that has two fields on it that are linked to a table.
When I click one of the fields a subform opens. On this subform I have
created a group of 9 checkboxes (like a matrix). If the first checkbox is
checked, I want the value "T" to be entered in the first field of the
mainform and the value "W" to be entered in the second field of the
mainform
then the subform should close. If the secondbox is checked then different
values should be entered in the feld and so on.

I suspect that I need to write a procedure in the propertiesfield on key
press of the first checkbox and do the same with the other checkboxes. But
I
don't know the code. Can anyone help me? The name of the mainform =
FrmOverzicht, the name of field 1 on the mainform = info and field 2 =
NNW.

Thanks in advance,
Yara



.

  #4  
Old November 28th, 2009, 02:32 PM posted to microsoft.public.access.forms
Yara
external usenet poster
 
Posts: 19
Default Group checkboxes on subform

In addition to my respons earlier: I noticed that when I use a group of
selection buttons there is no after update in the properties but when I use
just 1 selection button it does have after update. Same goes for checkboxes;
as soon as I put them in a group it loses the option for after update in the
properties.
I will use the buttons alone instead of grouped.

Thanks again for the help.

Regards,
Yara

"Jeanette Cunningham" wrote:

You can put code like this on the after update of the checkbox.

Private Sub Check1_AfterUpdate
If Me.Check1 = True Then
Me.Parent.[NameOfControlA] = "T"
Me.Parent.[NameOfControlB] = "W"
DoCmd.Close acForm, Me.Name
End If
End Sub


The above code assumes that the first checkbox is called Check1
Where the code has [NameOfControlA] , replace it with the name of the
control on the main form.
Do similar for [NameOfControlB]

Do a similar thing for the other 8 checkboxes.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Yara" wrote in message
...
Hello,

I am creating a form that has two fields on it that are linked to a table.
When I click one of the fields a subform opens. On this subform I have
created a group of 9 checkboxes (like a matrix). If the first checkbox is
checked, I want the value "T" to be entered in the first field of the
mainform and the value "W" to be entered in the second field of the
mainform
then the subform should close. If the secondbox is checked then different
values should be entered in the feld and so on.

I suspect that I need to write a procedure in the propertiesfield on key
press of the first checkbox and do the same with the other checkboxes. But
I
don't know the code. Can anyone help me? The name of the mainform =
FrmOverzicht, the name of field 1 on the mainform = info and field 2 =
NNW.

Thanks in advance,
Yara



.

  #5  
Old November 28th, 2009, 09:02 PM posted to microsoft.public.access.forms
Jeanette Cunningham
external usenet poster
 
Posts: 2,190
Default Group checkboxes on subform

When you use the 'selection button' - we call it an option group or frame.
Instead of using the after update for each check box or each button,
use the value for the option group.

If I have an option group with 3 checkboxes or selection buttons,
When I check the first checkbox, the option group will have the value =1.
When I check the second checkbox, the option group will have the value = 2.
Similar for the third checkbox ( assuming that check = show tick).

So your code uses the value of the option group (frame), instead of looking
for the value for each checkbox or button inside the frame.

If Not Is Null (Me.NameOfOptionGroup) Then
Select Case Me.NameOfOptionGroup
Case 1
'code to do something

Case 2
'code to do something

Case 3
'code to do something

End Select



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"Yara" wrote in message
...
In addition to my respons earlier: I noticed that when I use a group of
selection buttons there is no after update in the properties but when I
use
just 1 selection button it does have after update. Same goes for
checkboxes;
as soon as I put them in a group it loses the option for after update in
the
properties.
I will use the buttons alone instead of grouped.

Thanks again for the help.

Regards,
Yara

"Jeanette Cunningham" wrote:

You can put code like this on the after update of the checkbox.

Private Sub Check1_AfterUpdate
If Me.Check1 = True Then
Me.Parent.[NameOfControlA] = "T"
Me.Parent.[NameOfControlB] = "W"
DoCmd.Close acForm, Me.Name
End If
End Sub


The above code assumes that the first checkbox is called Check1
Where the code has [NameOfControlA] , replace it with the name of the
control on the main form.
Do similar for [NameOfControlB]

Do a similar thing for the other 8 checkboxes.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Yara" wrote in message
...
Hello,

I am creating a form that has two fields on it that are linked to a
table.
When I click one of the fields a subform opens. On this subform I have
created a group of 9 checkboxes (like a matrix). If the first checkbox
is
checked, I want the value "T" to be entered in the first field of the
mainform and the value "W" to be entered in the second field of the
mainform
then the subform should close. If the secondbox is checked then
different
values should be entered in the feld and so on.

I suspect that I need to write a procedure in the propertiesfield on
key
press of the first checkbox and do the same with the other checkboxes.
But
I
don't know the code. Can anyone help me? The name of the mainform =
FrmOverzicht, the name of field 1 on the mainform = info and field 2 =
NNW.

Thanks in advance,
Yara



.



  #6  
Old November 29th, 2009, 11:07 AM posted to microsoft.public.access.forms
Yara
external usenet poster
 
Posts: 19
Default Group checkboxes on subform

Thanks Jeanette,

It works excellent! This is fun I keep learning things.
Thanks again!
Kind regards,
Yara

"Jeanette Cunningham" wrote:

When you use the 'selection button' - we call it an option group or frame.
Instead of using the after update for each check box or each button,
use the value for the option group.

If I have an option group with 3 checkboxes or selection buttons,
When I check the first checkbox, the option group will have the value =1.
When I check the second checkbox, the option group will have the value = 2.
Similar for the third checkbox ( assuming that check = show tick).

So your code uses the value of the option group (frame), instead of looking
for the value for each checkbox or button inside the frame.

If Not Is Null (Me.NameOfOptionGroup) Then
Select Case Me.NameOfOptionGroup
Case 1
'code to do something

Case 2
'code to do something

Case 3
'code to do something

End Select



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia


"Yara" wrote in message
...
In addition to my respons earlier: I noticed that when I use a group of
selection buttons there is no after update in the properties but when I
use
just 1 selection button it does have after update. Same goes for
checkboxes;
as soon as I put them in a group it loses the option for after update in
the
properties.
I will use the buttons alone instead of grouped.

Thanks again for the help.

Regards,
Yara

"Jeanette Cunningham" wrote:

You can put code like this on the after update of the checkbox.

Private Sub Check1_AfterUpdate
If Me.Check1 = True Then
Me.Parent.[NameOfControlA] = "T"
Me.Parent.[NameOfControlB] = "W"
DoCmd.Close acForm, Me.Name
End If
End Sub


The above code assumes that the first checkbox is called Check1
Where the code has [NameOfControlA] , replace it with the name of the
control on the main form.
Do similar for [NameOfControlB]

Do a similar thing for the other 8 checkboxes.



Jeanette Cunningham MS Access MVP -- Melbourne Victoria Australia

"Yara" wrote in message
...
Hello,

I am creating a form that has two fields on it that are linked to a
table.
When I click one of the fields a subform opens. On this subform I have
created a group of 9 checkboxes (like a matrix). If the first checkbox
is
checked, I want the value "T" to be entered in the first field of the
mainform and the value "W" to be entered in the second field of the
mainform
then the subform should close. If the secondbox is checked then
different
values should be entered in the feld and so on.

I suspect that I need to write a procedure in the propertiesfield on
key
press of the first checkbox and do the same with the other checkboxes.
But
I
don't know the code. Can anyone help me? The name of the mainform =
FrmOverzicht, the name of field 1 on the mainform = info and field 2 =
NNW.

Thanks in advance,
Yara


.



.

 




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 05:45 AM.


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