Null Controls & Refresh

A

Andy Roberts

I have an option group acting as a search filter for a combo box on a form.
When I select from the combo it populates the form with the details of the
selection - this is fine. Heres what I'd like to do..

1. When I select an option from the option group and then click the cbobox
I'd like the form controls to be all blanks i.e. set to null (not delete a
record).

2. After selecting from the combo box and the form being populated I'd like
the combo box to then become blank.

I've played around with the after update and before update events but keep
getting errors.

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
 
K

Klatuu

Well, you could fix the errors.

or

maybe if you would tell us what errors you are getting and if they are run
time errors, what line of code the error is happening on, and post the code
you are trying to use to achieve your ojbective, we might have a fair chance
at helping.
 
A

Andy Roberts

Apologies Dave

Hopefully this may help... "I get error 2465 ...DB can't find frmClients
referred to in your expression" I hit Debug and VBA Editior opens at 3rd
line below. The event is on the click event of the option group

Private Sub fraDiscipline_Click()
Me![cboFindClient] = Null
Form![frmClients] = Null
End Sub

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
 
D

Douglas J. Steele

What are you hoping that the Form![frmClients] = Null statement will do?
Realistically, that makes no sense to me. You can set a control on a form to
Null, but you can't set a form to Null.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andy Roberts said:
Apologies Dave

Hopefully this may help... "I get error 2465 ...DB can't find frmClients
referred to in your expression" I hit Debug and VBA Editior opens at 3rd
line below. The event is on the click event of the option group

Private Sub fraDiscipline_Click()
Me![cboFindClient] = Null
Form![frmClients] = Null
End Sub

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
 
A

Andy Roberts

Doug

I appreciate the code is wrong and whatI'm trying to do is set all the
controls on a form to null when I select an option in an optiongroup without
having to set every control one after the other in the code as there could
be loads of controls. I was trying to set all of them with one lineof code.

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
Douglas J. Steele said:
What are you hoping that the Form![frmClients] = Null statement will do?
Realistically, that makes no sense to me. You can set a control on a form
to Null, but you can't set a form to Null.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andy Roberts said:
Apologies Dave

Hopefully this may help... "I get error 2465 ...DB can't find frmClients
referred to in your expression" I hit Debug and VBA Editior opens at 3rd
line below. The event is on the click event of the option group

Private Sub fraDiscipline_Click()
Me![cboFindClient] = Null
Form![frmClients] = Null
End Sub

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
Klatuu said:
Well, you could fix the errors.

or

maybe if you would tell us what errors you are getting and if they are
run
time errors, what line of code the error is happening on, and post the
code
you are trying to use to achieve your ojbective, we might have a fair
chance
at helping.
--
Dave Hargis, Microsoft Access MVP


:

I have an option group acting as a search filter for a combo box on a
form.
When I select from the combo it populates the form with the details of
the
selection - this is fine. Heres what I'd like to do..

1. When I select an option from the option group and then click the
cbobox
I'd like the form controls to be all blanks i.e. set to null (not
delete a
record).

2. After selecting from the combo box and the form being populated I'd
like
the combo box to then become blank.

I've played around with the after update and before update events but
keep
getting errors.

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
 
D

Douglas J. Steele

Sorry, it can't be done. You have no choice but to loop through all of the
controls. Unfortunately, too, not all control types can be set to Null (for
example, labels and lines can't be). You either need to check the type of
control or else set the Tag property of the controls you want to Null, and
check the Tag property.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andy Roberts said:
Doug

I appreciate the code is wrong and whatI'm trying to do is set all the
controls on a form to null when I select an option in an optiongroup
without having to set every control one after the other in the code as
there could be loads of controls. I was trying to set all of them with
one lineof code.

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
Douglas J. Steele said:
What are you hoping that the Form![frmClients] = Null statement will do?
Realistically, that makes no sense to me. You can set a control on a form
to Null, but you can't set a form to Null.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andy Roberts said:
Apologies Dave

Hopefully this may help... "I get error 2465 ...DB can't find
frmClients referred to in your expression" I hit Debug and VBA Editior
opens at 3rd line below. The event is on the click event of the option
group

Private Sub fraDiscipline_Click()
Me![cboFindClient] = Null
Form![frmClients] = Null
End Sub

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
Well, you could fix the errors.

or

maybe if you would tell us what errors you are getting and if they are
run
time errors, what line of code the error is happening on, and post the
code
you are trying to use to achieve your ojbective, we might have a fair
chance
at helping.
--
Dave Hargis, Microsoft Access MVP


:

I have an option group acting as a search filter for a combo box on a
form.
When I select from the combo it populates the form with the details of
the
selection - this is fine. Heres what I'd like to do..

1. When I select an option from the option group and then click the
cbobox
I'd like the form controls to be all blanks i.e. set to null (not
delete a
record).

2. After selecting from the combo box and the form being populated I'd
like
the combo box to then become blank.

I've played around with the after update and before update events but
keep
getting errors.

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
 
A

Andy Roberts

Fair enough

Thanks for that, at least I wont waste anytime trying to source a
nonexistant solution

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
Douglas J. Steele said:
Sorry, it can't be done. You have no choice but to loop through all of the
controls. Unfortunately, too, not all control types can be set to Null
(for example, labels and lines can't be). You either need to check the
type of control or else set the Tag property of the controls you want to
Null, and check the Tag property.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Andy Roberts said:
Doug

I appreciate the code is wrong and whatI'm trying to do is set all the
controls on a form to null when I select an option in an optiongroup
without having to set every control one after the other in the code as
there could be loads of controls. I was trying to set all of them with
one lineof code.

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
Douglas J. Steele said:
What are you hoping that the Form![frmClients] = Null statement will do?
Realistically, that makes no sense to me. You can set a control on a
form to Null, but you can't set a form to Null.

--
Doug Steele, Microsoft Access MVP

(no e-mails, please!)


Apologies Dave

Hopefully this may help... "I get error 2465 ...DB can't find
frmClients referred to in your expression" I hit Debug and VBA Editior
opens at 3rd line below. The event is on the click event of the option
group

Private Sub fraDiscipline_Click()
Me![cboFindClient] = Null
Form![frmClients] = Null
End Sub

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
Well, you could fix the errors.

or

maybe if you would tell us what errors you are getting and if they are
run
time errors, what line of code the error is happening on, and post the
code
you are trying to use to achieve your ojbective, we might have a fair
chance
at helping.
--
Dave Hargis, Microsoft Access MVP


:

I have an option group acting as a search filter for a combo box on a
form.
When I select from the combo it populates the form with the details
of the
selection - this is fine. Heres what I'd like to do..

1. When I select an option from the option group and then click the
cbobox
I'd like the form controls to be all blanks i.e. set to null (not
delete a
record).

2. After selecting from the combo box and the form being populated
I'd like
the combo box to then become blank.

I've played around with the after update and before update events but
keep
getting errors.

--
Regards

Andy
___________
Andy Roberts
Win XP Pro
Access 2007
 

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