Code for Checkbox and Listbox

G

Guest

Hi everyone,
I am creating a database for another manager and am trying to figure out the
proper code for a scenerio. I have checkbox1 and list38. I would like the
list38 only be enabled if checkbox1 is checked off. I know the code would
start something like this:
If checkbox1 = True Then
Can someone please assist. Thank you.
 
G

Guest

Try something like:

Me.[list38].Enabled = (Me.[checkbox1] = False)

This code need to be located in the AfterUpdate event of the checkbox1, and
if you move between records add this line also to the OnCurrent event of the
form
 
F

fredg

Hi everyone,
I am creating a database for another manager and am trying to figure out the
proper code for a scenerio. I have checkbox1 and list38. I would like the
list38 only be enabled if checkbox1 is checked off. I know the code would
start something like this:
If checkbox1 = True Then
Can someone please assist. Thank you.

Doe the Check box AfterUpdate event, as well as the Form's Current
event:

Me![List38.Enabled = Me![Checkbox1]

You might want to think about naming your controls with more
descriptive names. Combo1 or List38 doesn't let any future developer
know what it's purpose is.
 
G

Guest

This code works for what i am trying to do but if i go to create a new record
i receive the following error:

I have but the code in the afterupdate and form_current. Is that the
correct place? The code i put is

Me.List38.Enabled = Me.checkbox3

fredg said:
Hi everyone,
I am creating a database for another manager and am trying to figure out the
proper code for a scenerio. I have checkbox1 and list38. I would like the
list38 only be enabled if checkbox1 is checked off. I know the code would
start something like this:
If checkbox1 = True Then
Can someone please assist. Thank you.

Doe the Check box AfterUpdate event, as well as the Form's Current
event:

Me![List38.Enabled = Me![Checkbox1]

You might want to think about naming your controls with more
descriptive names. Combo1 or List38 doesn't let any future developer
know what it's purpose is.
 
G

Guest

I forgot to put the error:
Invalid use of null and then it takes me to:


Private Sub Form_Current()

Me.List38.Enabled = Me.checkbox3

End Sub

scott04 said:
This code works for what i am trying to do but if i go to create a new record
i receive the following error:

I have but the code in the afterupdate and form_current. Is that the
correct place? The code i put is

Me.List38.Enabled = Me.checkbox3

fredg said:
Hi everyone,
I am creating a database for another manager and am trying to figure out the
proper code for a scenerio. I have checkbox1 and list38. I would like the
list38 only be enabled if checkbox1 is checked off. I know the code would
start something like this:
If checkbox1 = True Then
Can someone please assist. Thank you.

Doe the Check box AfterUpdate event, as well as the Form's Current
event:

Me![List38.Enabled = Me![Checkbox1]

You might want to think about naming your controls with more
descriptive names. Combo1 or List38 doesn't let any future developer
know what it's purpose is.
 
D

Douglas J. Steele

Private Sub Form_Current()

Me.List38.Enabled = Nz(Me.checkbox3, False)

End Sub

or

Private Sub Form_Current()

Me.checkbox3 = False
Me.List38.Enabled = Me.checkbox3

End Sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scott04 said:
I forgot to put the error:
Invalid use of null and then it takes me to:


Private Sub Form_Current()

Me.List38.Enabled = Me.checkbox3

End Sub

scott04 said:
This code works for what i am trying to do but if i go to create a new
record
i receive the following error:

I have but the code in the afterupdate and form_current. Is that the
correct place? The code i put is

Me.List38.Enabled = Me.checkbox3

fredg said:
On Fri, 19 Oct 2007 06:03:01 -0700, scott04 wrote:

Hi everyone,
I am creating a database for another manager and am trying to figure
out the
proper code for a scenerio. I have checkbox1 and list38. I would
like the
list38 only be enabled if checkbox1 is checked off. I know the code
would
start something like this:
If checkbox1 = True Then
Can someone please assist. Thank you.

Doe the Check box AfterUpdate event, as well as the Form's Current
event:

Me![List38.Enabled = Me![Checkbox1]

You might want to think about naming your controls with more
descriptive names. Combo1 or List38 doesn't let any future developer
know what it's purpose is.
 
G

Guest

Douglas,
This did help however when i check on the bottom star to add a new record
for some reason i get this message:
"Mircosoft office access can't find the marco '.'
The marco (or its marco group) doesn't exist, or the marco is new but hasnt
been saved. Note that when you enter the marcogroupname.marconame syntax in
an argument, you must specifiy the name the marco's marco group was last
saved under."
Any thoughts on what this may mean? Thanks.

Douglas J. Steele said:
Private Sub Form_Current()

Me.List38.Enabled = Nz(Me.checkbox3, False)

End Sub

or

Private Sub Form_Current()

Me.checkbox3 = False
Me.List38.Enabled = Me.checkbox3

End Sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scott04 said:
I forgot to put the error:
Invalid use of null and then it takes me to:


Private Sub Form_Current()

Me.List38.Enabled = Me.checkbox3

End Sub

scott04 said:
This code works for what i am trying to do but if i go to create a new
record
i receive the following error:

I have but the code in the afterupdate and form_current. Is that the
correct place? The code i put is

Me.List38.Enabled = Me.checkbox3

:

On Fri, 19 Oct 2007 06:03:01 -0700, scott04 wrote:

Hi everyone,
I am creating a database for another manager and am trying to figure
out the
proper code for a scenerio. I have checkbox1 and list38. I would
like the
list38 only be enabled if checkbox1 is checked off. I know the code
would
start something like this:
If checkbox1 = True Then
Can someone please assist. Thank you.

Doe the Check box AfterUpdate event, as well as the Form's Current
event:

Me![List38.Enabled = Me![Checkbox1]

You might want to think about naming your controls with more
descriptive names. Combo1 or List38 doesn't let any future developer
know what it's purpose is.
 
D

Douglas J. Steele

I suspect the error actually said macro and macro group...

Try doing a compile of your application (on the Debug menu when you're in
the VB Editor) and see whether it complains about anything.

If that doesn't turn up any culprits, make a back-up of your application and
try decompiling it. Tony Toews has instructions at
http://www.granite.ab.ca/access/decompile.htm

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scott04 said:
Douglas,
This did help however when i check on the bottom star to add a new record
for some reason i get this message:
"Mircosoft office access can't find the marco '.'
The marco (or its marco group) doesn't exist, or the marco is new but
hasnt
been saved. Note that when you enter the marcogroupname.marconame syntax
in
an argument, you must specifiy the name the marco's marco group was last
saved under."
Any thoughts on what this may mean? Thanks.

Douglas J. Steele said:
Private Sub Form_Current()

Me.List38.Enabled = Nz(Me.checkbox3, False)

End Sub

or

Private Sub Form_Current()

Me.checkbox3 = False
Me.List38.Enabled = Me.checkbox3

End Sub



--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


scott04 said:
I forgot to put the error:
Invalid use of null and then it takes me to:


Private Sub Form_Current()

Me.List38.Enabled = Me.checkbox3

End Sub

:

This code works for what i am trying to do but if i go to create a new
record
i receive the following error:

I have but the code in the afterupdate and form_current. Is that the
correct place? The code i put is

Me.List38.Enabled = Me.checkbox3

:

On Fri, 19 Oct 2007 06:03:01 -0700, scott04 wrote:

Hi everyone,
I am creating a database for another manager and am trying to
figure
out the
proper code for a scenerio. I have checkbox1 and list38. I would
like the
list38 only be enabled if checkbox1 is checked off. I know the
code
would
start something like this:
If checkbox1 = True Then
Can someone please assist. Thank you.

Doe the Check box AfterUpdate event, as well as the Form's Current
event:

Me![List38.Enabled = Me![Checkbox1]

You might want to think about naming your controls with more
descriptive names. Combo1 or List38 doesn't let any future developer
know what it's purpose is.
 

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