 |
| Access VBA Discuss using VBA for Access programming. |
Welcome to the p2p.wrox.com Forums.
You are currently viewing the Access VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
|
|
|
|

June 15th, 2011, 05:48 PM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Access 2007 Check Box Question
I have a check box that I'd like to link to a text value in Access 2007 but I can't seem to make it work. The field I'm pointing to has either a yes or no value, I tried to change the field data type in my table but access ate my data.
The text box is unbound and I've tried the following code to no avail.
Code:
Private Sub cboxconf_Click()
Dim conf As String
conf = [qry800-53_Controls].[Confidentiality]
If conf = "Yes" Then
Me.cboxconf.Value = -1
Else: Me.cboxconf.Value = 0
End Sub
I would appreciate any assistance given.
|
|

June 16th, 2011, 08:05 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
HI..
what is happening.. what's the error?
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

June 16th, 2011, 09:37 AM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Access 2007 Check Box Question
Absolutely nothing happens.
I have a join that merges data off of two tables called qry800-53_Controls and I want the check box to correspond to a text yes/no value from the field Confidentiality. I imported the data that is in the field but when I tried to convert it to yes/no access made all fields no even the empty ones.
The value in Confidentiality is either yes or no. Does my code look like it would even work?
Thanks very much for your help.
E
|
|

June 16th, 2011, 09:44 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
Well.. it will work, when you click on it, since you are using the click event of the control...
Maybe you need it somewhere else?? probably when you load the form or the recordset?
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

June 16th, 2011, 09:47 AM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm sorry but I'm a bit of a noob with VBA, if not onclick what should it be?
|
|

June 16th, 2011, 09:54 AM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
I don't know, that depends on you app... where do you want to execute it?? when you retrieve the data? when the user fill the textbox?
Onclick will execute every time you click the checkbox..
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

June 16th, 2011, 10:08 AM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Sorry, I should have been more clear on that point.
I'd like the check box to show the value on a form in Access when the record is displayed in that form. When the user moves from one record to the next via command button the value for the box should update based on it's value for the new record.
I tried both Afterupdate and Beforeupdate but still got the same results, nothing.
|
|

June 16th, 2011, 12:03 PM
|
|
Friend of Wrox
|
|
Join Date: Jun 2003
Posts: 2,189
Thanks: 5
Thanked 59 Times in 57 Posts
|
|
Update only occurs when you update the table, not when you move between records. I don't remember the events on access, but it should have somewhere where you could do that...
__________________
HTH
Gonzalo
================================================== =========
Read this if you want to know how to get a correct reply for your question.
(Took that from Doug signature and he Took that from Peter profile)
================================================== =========
My programs achieved a new certification :
WORKS ON MY MACHINE
================================================== =========
I know that CVS was evil, and now i got the proof.
================================================== =========
|
|

June 16th, 2011, 12:27 PM
|
|
Registered User
|
|
Join Date: Jun 2011
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I'm going to try to address my data type mismatch and let Access handle the checkbox.
Thanks for your assistance,
E
|
|
 |