Create New Record

E

EjFizzy

At the moment I have a Form whereby if you select a certain check box others
greyout and cannot be selected. What happens when i put one record in and
then save and go onto a new record it remembers what boxes were ticked and
what werent. i want the new record to always open up with all boxes having
the option of being ticked.
 
A

Arvin Meyer [MVP]

Use the Current event to reset all the checkboxes (air code):

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
End If
End Sub
 
E

EjFizzy

I just copied and pasted that in the code builder. It didnt work the boxes
were still greyed out
 
A

Arvin Meyer [MVP]

I just checked the code on a bound form with both bound and unbound checkbox
controls and the code worked perfectly. I'm guessing that your controls are
unbound and they won't maintain the value in a table because you describe
them as being NULL (grayed out) on new records. Do you have any code or
properties which disables them (another possible reason for being grayed
out)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
E

EjFizzy

yeah i do have a disabled code on them this is an example below:


Private Sub Walk_in_Assisted_AfterUpdate()
If [Walk_in_Assisted].Value = True Then
[Walk_in_Self_selected].Enabled = False
[Sent_Resources].Enabled = False
Else
[Walk_in_Self_selected].Enabled = True
[Sent_Resources].Enabled = True
End If

End Sub
 
A

Arvin Meyer [MVP]

Comment out that code and try this:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub

Now checkboxes on existing records cannot be changed.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com



EjFizzy said:
yeah i do have a disabled code on them this is an example below:


Private Sub Walk_in_Assisted_AfterUpdate()
If [Walk_in_Assisted].Value = True Then
[Walk_in_Self_selected].Enabled = False
[Sent_Resources].Enabled = False
Else
[Walk_in_Self_selected].Enabled = True
[Sent_Resources].Enabled = True
End If

End Sub

Arvin Meyer said:
I just checked the code on a bound form with both bound and unbound
checkbox
controls and the code worked perfectly. I'm guessing that your controls
are
unbound and they won't maintain the value in a table because you describe
them as being NULL (grayed out) on new records. Do you have any code or
properties which disables them (another possible reason for being grayed
out)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com
 
E

EjFizzy

sorry i should have explained that, that was one example of a code. What my
form does is that a person can only select a certain type i.e. Walk-in self
selected or walk-in assisted or sent resources. So if someone chooses walk-in
self selected then they cannot choose any of the other two so they get greyed
out as such. That code works fine, but when i go to put in record 2 of 2 the
checkboxes remained grey out and what i want is for the default values to go
back to normal

Arvin Meyer said:
Comment out that code and try this:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub

Now checkboxes on existing records cannot be changed.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com



EjFizzy said:
yeah i do have a disabled code on them this is an example below:


Private Sub Walk_in_Assisted_AfterUpdate()
If [Walk_in_Assisted].Value = True Then
[Walk_in_Self_selected].Enabled = False
[Sent_Resources].Enabled = False
Else
[Walk_in_Self_selected].Enabled = True
[Sent_Resources].Enabled = True
End If

End Sub

Arvin Meyer said:
I just checked the code on a bound form with both bound and unbound
checkbox
controls and the code worked perfectly. I'm guessing that your controls
are
unbound and they won't maintain the value in a table because you describe
them as being NULL (grayed out) on new records. Do you have any code or
properties which disables them (another possible reason for being grayed
out)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


I just copied and pasted that in the code builder. It didnt work the
boxes
were still greyed out

:

Use the Current event to reset all the checkboxes (air code):

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
End If
End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


At the moment I have a Form whereby if you select a certain check
box
others
greyout and cannot be selected. What happens when i put one record
in
and
then save and go onto a new record it remembers what boxes were
ticked
and
what werent. i want the new record to always open up with all boxes
having
the option of being ticked.
 
L

Larry Linson

They are "greyed out" to reflect the fact that you set their Enabled propety
to False. What did you do to reset it for the next record? The AfterUpdate
event of the Form is intended for actions that are to be performed after the
record is written. I'd presume you want to enable all three options.

Larry LInson
Microoft Office Access MVP


EjFizzy said:
sorry i should have explained that, that was one example of a code. What
my
form does is that a person can only select a certain type i.e. Walk-in
self
selected or walk-in assisted or sent resources. So if someone chooses
walk-in
self selected then they cannot choose any of the other two so they get
greyed
out as such. That code works fine, but when i go to put in record 2 of 2
the
checkboxes remained grey out and what i want is for the default values to
go
back to normal

Arvin Meyer said:
Comment out that code and try this:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub

Now checkboxes on existing records cannot be changed.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com



EjFizzy said:
yeah i do have a disabled code on them this is an example below:


Private Sub Walk_in_Assisted_AfterUpdate()
If [Walk_in_Assisted].Value = True Then
[Walk_in_Self_selected].Enabled = False
[Sent_Resources].Enabled = False
Else
[Walk_in_Self_selected].Enabled = True
[Sent_Resources].Enabled = True
End If

End Sub

:

I just checked the code on a bound form with both bound and unbound
checkbox
controls and the code worked perfectly. I'm guessing that your
controls
are
unbound and they won't maintain the value in a table because you
describe
them as being NULL (grayed out) on new records. Do you have any code
or
properties which disables them (another possible reason for being
grayed
out)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


I just copied and pasted that in the code builder. It didnt work the
boxes
were still greyed out

:

Use the Current event to reset all the checkboxes (air code):

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
End If
End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


At the moment I have a Form whereby if you select a certain check
box
others
greyout and cannot be selected. What happens when i put one
record
in
and
then save and go onto a new record it remembers what boxes were
ticked
and
what werent. i want the new record to always open up with all
boxes
having
the option of being ticked.
 
E

EjFizzy

Thats the thing Larry i havent done anything to reenable them for the next
record, thats my question (sorry i didnt explain real well...). i want them
all to active when i go to the next record. Any suggestions...

Larry Linson said:
They are "greyed out" to reflect the fact that you set their Enabled propety
to False. What did you do to reset it for the next record? The AfterUpdate
event of the Form is intended for actions that are to be performed after the
record is written. I'd presume you want to enable all three options.

Larry LInson
Microoft Office Access MVP


EjFizzy said:
sorry i should have explained that, that was one example of a code. What
my
form does is that a person can only select a certain type i.e. Walk-in
self
selected or walk-in assisted or sent resources. So if someone chooses
walk-in
self selected then they cannot choose any of the other two so they get
greyed
out as such. That code works fine, but when i go to put in record 2 of 2
the
checkboxes remained grey out and what i want is for the default values to
go
back to normal

Arvin Meyer said:
Comment out that code and try this:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub

Now checkboxes on existing records cannot be changed.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com



yeah i do have a disabled code on them this is an example below:


Private Sub Walk_in_Assisted_AfterUpdate()
If [Walk_in_Assisted].Value = True Then
[Walk_in_Self_selected].Enabled = False
[Sent_Resources].Enabled = False
Else
[Walk_in_Self_selected].Enabled = True
[Sent_Resources].Enabled = True
End If

End Sub

:

I just checked the code on a bound form with both bound and unbound
checkbox
controls and the code worked perfectly. I'm guessing that your
controls
are
unbound and they won't maintain the value in a table because you
describe
them as being NULL (grayed out) on new records. Do you have any code
or
properties which disables them (another possible reason for being
grayed
out)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


I just copied and pasted that in the code builder. It didnt work the
boxes
were still greyed out

:

Use the Current event to reset all the checkboxes (air code):

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
End If
End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


At the moment I have a Form whereby if you select a certain check
box
others
greyout and cannot be selected. What happens when i put one
record
in
and
then save and go onto a new record it remembers what boxes were
ticked
and
what werent. i want the new record to always open up with all
boxes
having
the option of being ticked.
 
A

Arvin Meyer [MVP]

I got some of the code wrong because of cutting and pasting:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled = True
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

EjFizzy said:
Thats the thing Larry i havent done anything to reenable them for the next
record, thats my question (sorry i didnt explain real well...). i want
them
all to active when i go to the next record. Any suggestions...

Larry Linson said:
They are "greyed out" to reflect the fact that you set their Enabled
propety
to False. What did you do to reset it for the next record? The
AfterUpdate
event of the Form is intended for actions that are to be performed after
the
record is written. I'd presume you want to enable all three options.

Larry LInson
Microoft Office Access MVP


EjFizzy said:
sorry i should have explained that, that was one example of a code.
What
my
form does is that a person can only select a certain type i.e. Walk-in
self
selected or walk-in assisted or sent resources. So if someone chooses
walk-in
self selected then they cannot choose any of the other two so they get
greyed
out as such. That code works fine, but when i go to put in record 2 of
2
the
checkboxes remained grey out and what i want is for the default values
to
go
back to normal

:

Comment out that code and try this:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub

Now checkboxes on existing records cannot be changed.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com



yeah i do have a disabled code on them this is an example below:


Private Sub Walk_in_Assisted_AfterUpdate()
If [Walk_in_Assisted].Value = True Then
[Walk_in_Self_selected].Enabled = False
[Sent_Resources].Enabled = False
Else
[Walk_in_Self_selected].Enabled = True
[Sent_Resources].Enabled = True
End If

End Sub

:

I just checked the code on a bound form with both bound and unbound
checkbox
controls and the code worked perfectly. I'm guessing that your
controls
are
unbound and they won't maintain the value in a table because you
describe
them as being NULL (grayed out) on new records. Do you have any
code
or
properties which disables them (another possible reason for being
grayed
out)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


I just copied and pasted that in the code builder. It didnt work
the
boxes
were still greyed out

:

Use the Current event to reset all the checkboxes (air code):

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
End If
End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


At the moment I have a Form whereby if you select a certain
check
box
others
greyout and cannot be selected. What happens when i put one
record
in
and
then save and go onto a new record it remembers what boxes
were
ticked
and
what werent. i want the new record to always open up with all
boxes
having
the option of being ticked.
 
E

EjFizzy

THANK YOU!!! this worked yah...

Arvin Meyer said:
I got some of the code wrong because of cutting and pasting:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled = True
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

EjFizzy said:
Thats the thing Larry i havent done anything to reenable them for the next
record, thats my question (sorry i didnt explain real well...). i want
them
all to active when i go to the next record. Any suggestions...

Larry Linson said:
They are "greyed out" to reflect the fact that you set their Enabled
propety
to False. What did you do to reset it for the next record? The
AfterUpdate
event of the Form is intended for actions that are to be performed after
the
record is written. I'd presume you want to enable all three options.

Larry LInson
Microoft Office Access MVP


sorry i should have explained that, that was one example of a code.
What
my
form does is that a person can only select a certain type i.e. Walk-in
self
selected or walk-in assisted or sent resources. So if someone chooses
walk-in
self selected then they cannot choose any of the other two so they get
greyed
out as such. That code works fine, but when i go to put in record 2 of
2
the
checkboxes remained grey out and what i want is for the default values
to
go
back to normal

:

Comment out that code and try this:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub

Now checkboxes on existing records cannot be changed.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com



yeah i do have a disabled code on them this is an example below:


Private Sub Walk_in_Assisted_AfterUpdate()
If [Walk_in_Assisted].Value = True Then
[Walk_in_Self_selected].Enabled = False
[Sent_Resources].Enabled = False
Else
[Walk_in_Self_selected].Enabled = True
[Sent_Resources].Enabled = True
End If

End Sub

:

I just checked the code on a bound form with both bound and unbound
checkbox
controls and the code worked perfectly. I'm guessing that your
controls
are
unbound and they won't maintain the value in a table because you
describe
them as being NULL (grayed out) on new records. Do you have any
code
or
properties which disables them (another possible reason for being
grayed
out)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


I just copied and pasted that in the code builder. It didnt work
the
boxes
were still greyed out

:

Use the Current event to reset all the checkboxes (air code):

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
End If
End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


At the moment I have a Form whereby if you select a certain
check
box
others
greyout and cannot be selected. What happens when i put one
record
in
and
then save and go onto a new record it remembers what boxes
were
ticked
and
what werent. i want the new record to always open up with all
boxes
having
the option of being ticked.
 
I

imogene bown

EjFizzy said:
THANK YOU!!! this worked yah...

Arvin Meyer said:
I got some of the code wrong because of cutting and pasting:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled = True
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com

EjFizzy said:
Thats the thing Larry i havent done anything to reenable them for the next
record, thats my question (sorry i didnt explain real well...). i want
them
all to active when i go to the next record. Any suggestions...

:

They are "greyed out" to reflect the fact that you set their Enabled
propety
to False. What did you do to reset it for the next record? The
AfterUpdate
event of the Form is intended for actions that are to be performed after
the
record is written. I'd presume you want to enable all three options.

Larry LInson
Microoft Office Access MVP


sorry i should have explained that, that was one example of a code.
What
my
form does is that a person can only select a certain type i.e. Walk-in
self
selected or walk-in assisted or sent resources. So if someone chooses
walk-in
self selected then they cannot choose any of the other two so they get
greyed
out as such. That code works fine, but when i go to put in record 2 of
2
the
checkboxes remained grey out and what i want is for the default values
to
go
back to normal

:

Comment out that code and try this:

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
Else
For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Enabled= False
End If
End With
Next
End If
End Sub

Now checkboxes on existing records cannot be changed.
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com



yeah i do have a disabled code on them this is an example below:


Private Sub Walk_in_Assisted_AfterUpdate()
If [Walk_in_Assisted].Value = True Then
[Walk_in_Self_selected].Enabled = False
[Sent_Resources].Enabled = False
Else
[Walk_in_Self_selected].Enabled = True
[Sent_Resources].Enabled = True
End If

End Sub

:

I just checked the code on a bound form with both bound and unbound
checkbox
controls and the code worked perfectly. I'm guessing that your
controls
are
unbound and they won't maintain the value in a table because you
describe
them as being NULL (grayed out) on new records. Do you have any
code
or
properties which disables them (another possible reason for being
grayed
out)
--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


I just copied and pasted that in the code builder. It didnt work
the
boxes
were still greyed out

:

Use the Current event to reset all the checkboxes (air code):

Private Sub Form_Current()
Dim ctl As Control

If Me.NewRecord = True Then

For Each ctl In Me.Controls
With ctl
If .ControlType = acCheckBox Then
.Value = False
End If
End With
Next
End If
End Sub

--
Arvin Meyer, MCP, MVP
http://www.datastrat.com
http://www.mvps.org/access
http://www.accessmvp.com


At the moment I have a Form whereby if you select a certain
check
box
others
greyout and cannot be selected. What happens when i put one
record
in
and
then save and go onto a new record it remembers what boxes
were
ticked
and
what werent. i want the new record to always open up with all
boxes
having
the option of being ticked.
 

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