show field depending on checkbox

G

Guest

I have a query with 35 fields. on the form I'd like to create 35 checkboxes.
user may check or uncheck them depending on he fields thay want to see. is it
possible? how to pass checkboxes true/fals to query? or how to hide
unnecessary columnes on the form (datasheet)?

help please
 
D

Douglas J. Steele

In the AfterUpdate of each of the 35 checkboxes, you'd need code like:

Me.MyTextbox.Visible = Me.MyCheckbox

to have MyTextbox be visible if MyCheckbox is checked (and not visible if
MyCheckbox is unchecked)
 
G

Guest

in thiss case textboxes will fall out the form here and there and will look
ugly.
textboxes are in gethered in columnes. if one is out in the middle, rest
won't shift up.

and what to do with datashees columnes?
 
G

Guest

in this case I have to write 35 'if else' statements. othervice unchecked
checkbox's value is null and I get error. there has to be easier way!!!

Ofer said:
You can set the fields ColumnHidden on the load event of the form.


--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


VB said:
if another form is closed I get err Msg. if it's closed, columnes are not
hiding!

Ofer said:
To hide a field in another form

Forms![Form Name]![FieldName].ColumnHidden = True

In a SubForm

Forms![Form Name]![Sub Form NAme].Form![FieldName].ColumnHidden = True

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


:

O. and one more thing. it's not Me. it's another form! there is one form with
checkboxes and another one (maybe subform) with textboxes (or datasheet).

:

In the AfterUpdate of each of the 35 checkboxes, you'd need code like:

Me.MyTextbox.Visible = Me.MyCheckbox

to have MyTextbox be visible if MyCheckbox is checked (and not visible if
MyCheckbox is unchecked)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I have a query with 35 fields. on the form I'd like to create 35
checkboxes.
user may check or uncheck them depending on he fields thay want to see. is
it
possible? how to pass checkboxes true/fals to query? or how to hide
unnecessary columnes on the form (datasheet)?

help please
 
G

Guest

O. and one more thing. it's not Me. it's another form! there is one form with
checkboxes and another one (maybe subform) with textboxes (or datasheet).
 
G

Guest

to be more specific.

form has to take information from another form. if checkboxes are checked,
datasheet will show up, if unchecked, thay will hide.

when I load for, how can I check if boxes are checked or unchecked on other
form?

thanks
 
G

Guest

Instead of If , then, you can write

Forms![Form Name1]![FieldName].ColumnHidden = (Forms![FormName]![Check Box
FieldName] = True)
Forms![Form Name2]![FieldName].ColumnHidden = (Forms![FormName]![Check Box
FieldName] = True)

I can't see the code you are using currently, bu you can use the above example

Or, you can change the name of the fields, to contain a name + running
number, and then you can run the code

For I = 1 To 35
Me("fieldName" & I).ColumnHidden = (Me.[CheckBoxName] = True)
Next I

i hope the example are clear
--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


VB said:
in this case I have to write 35 'if else' statements. othervice unchecked
checkbox's value is null and I get error. there has to be easier way!!!

Ofer said:
You can set the fields ColumnHidden on the load event of the form.


--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


VB said:
if another form is closed I get err Msg. if it's closed, columnes are not
hiding!

:

To hide a field in another form

Forms![Form Name]![FieldName].ColumnHidden = True

In a SubForm

Forms![Form Name]![Sub Form NAme].Form![FieldName].ColumnHidden = True

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


:

O. and one more thing. it's not Me. it's another form! there is one form with
checkboxes and another one (maybe subform) with textboxes (or datasheet).

:

In the AfterUpdate of each of the 35 checkboxes, you'd need code like:

Me.MyTextbox.Visible = Me.MyCheckbox

to have MyTextbox be visible if MyCheckbox is checked (and not visible if
MyCheckbox is unchecked)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I have a query with 35 fields. on the form I'd like to create 35
checkboxes.
user may check or uncheck them depending on he fields thay want to see. is
it
possible? how to pass checkboxes true/fals to query? or how to hide
unnecessary columnes on the form (datasheet)?

help please
 
G

Guest

To hide a field in another form

Forms![Form Name]![FieldName].ColumnHidden = True

In a SubForm

Forms![Form Name]![Sub Form NAme].Form![FieldName].ColumnHidden = True
 
G

Guest

first way works, just there has to be 'false' instead of 'true' to hide
unchecked and show checked.
i'll try second one later...
wonderfull!
thank you!

Ofer said:
Instead of If , then, you can write

Forms![Form Name1]![FieldName].ColumnHidden = (Forms![FormName]![Check Box
FieldName] = True)
Forms![Form Name2]![FieldName].ColumnHidden = (Forms![FormName]![Check Box
FieldName] = True)

I can't see the code you are using currently, bu you can use the above example

Or, you can change the name of the fields, to contain a name + running
number, and then you can run the code

For I = 1 To 35
Me("fieldName" & I).ColumnHidden = (Me.[CheckBoxName] = True)
Next I

i hope the example are clear
--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


VB said:
in this case I have to write 35 'if else' statements. othervice unchecked
checkbox's value is null and I get error. there has to be easier way!!!

Ofer said:
You can set the fields ColumnHidden on the load event of the form.


--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


:

if another form is closed I get err Msg. if it's closed, columnes are not
hiding!

:

To hide a field in another form

Forms![Form Name]![FieldName].ColumnHidden = True

In a SubForm

Forms![Form Name]![Sub Form NAme].Form![FieldName].ColumnHidden = True

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


:

O. and one more thing. it's not Me. it's another form! there is one form with
checkboxes and another one (maybe subform) with textboxes (or datasheet).

:

In the AfterUpdate of each of the 35 checkboxes, you'd need code like:

Me.MyTextbox.Visible = Me.MyCheckbox

to have MyTextbox be visible if MyCheckbox is checked (and not visible if
MyCheckbox is unchecked)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I have a query with 35 fields. on the form I'd like to create 35
checkboxes.
user may check or uncheck them depending on he fields thay want to see. is
it
possible? how to pass checkboxes true/fals to query? or how to hide
unnecessary columnes on the form (datasheet)?

help please
 
D

Douglas J. Steele

So use

Forms!MyOtherForm!MyTextbox.Visible = Me.MyCheckbox

or

Forms!MyOtherForm.SubForm.Form!MyTextbox.Visible = Me.MyCheckbox
 
G

Guest

if another form is closed I get err Msg. if it's closed, columnes are not
hiding!

Ofer said:
To hide a field in another form

Forms![Form Name]![FieldName].ColumnHidden = True

In a SubForm

Forms![Form Name]![Sub Form NAme].Form![FieldName].ColumnHidden = True

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


VB said:
O. and one more thing. it's not Me. it's another form! there is one form with
checkboxes and another one (maybe subform) with textboxes (or datasheet).
 
G

Guest

You can set the fields ColumnHidden on the load event of the form.


--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


VB said:
if another form is closed I get err Msg. if it's closed, columnes are not
hiding!

Ofer said:
To hide a field in another form

Forms![Form Name]![FieldName].ColumnHidden = True

In a SubForm

Forms![Form Name]![Sub Form NAme].Form![FieldName].ColumnHidden = True

--
The next line is only relevant to Microsoft''s web-based interface users.
If I answered your question, please mark it as an answer. It''s useful to
know that my answer was helpful
HTH, good luck


VB said:
O. and one more thing. it's not Me. it's another form! there is one form with
checkboxes and another one (maybe subform) with textboxes (or datasheet).

:

In the AfterUpdate of each of the 35 checkboxes, you'd need code like:

Me.MyTextbox.Visible = Me.MyCheckbox

to have MyTextbox be visible if MyCheckbox is checked (and not visible if
MyCheckbox is unchecked)

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)



I have a query with 35 fields. on the form I'd like to create 35
checkboxes.
user may check or uncheck them depending on he fields thay want to see. is
it
possible? how to pass checkboxes true/fals to query? or how to hide
unnecessary columnes on the form (datasheet)?

help please
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top