Hi Jessica,
it is a good idea to RENAME controls before adding code to them. Instead of 'Frame332', name the control something like 'framePsych'
What if the control has no value yet?
If IsNull(me.framePsych) then exit sub
or
Select Case nz(me.framePsych,2) 'assume No is the default value
~~~
for fields that have a Yes/No answer, I would recommend storing as Yes/No data type or Integer data type. If you set to Yes/No, you can set the display to Yes/No instead of True/False. Then you could make your option values -1 and 0 to correspond to the numeric values for True and False so you do not even need code.
Warm Regards,
Crystal
*
(: have an awesome day :)
*
On Wednesday, October 1, 2014 3:57 PM, "Duane Hookom duanehookom@hotmail.com [MS_Access_Professionals]" <MS_Access_Professionals@yahoogroups.com> wrote:
When I click reply from outlook.com, the previous information from the thread is automatically included so it is the default for me ;-)
There are some tips about how to debug code at http://www.tek-tips.com/faqs.cfm?fid=7148.
It would be interesting to find out which line causes the error message. What happens if you add a new, blank text box (nothing in the control source) to your form named "txtMyNewControl" and then changed your code to:
Private Sub Frame332_AfterUpdate()
Select Case Frame332.Value
Case 1
Me.txtMyNewControl = "Yes" 'Psych.Value = "Yes"
Case 2
Me.txtMyNewControl = "No" 'Psych.Value = "No"
End Select
End Sub
This might narrow down your problem to see if the value of Psych can be set or not.
Duane Hookom, MVP
MS Access
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Wed, 1 Oct 2014 14:11:41 -0700
Subject: [MS_AccessPros] Re: option group error message
Now I don't even know if i pushing the correct reply button. I apologize if you don't have the message history, I have it so I'm assuming you do.
"Psych" is a unique name for the text box which has as it's control source a text field. I try very hard to give everything a unique name so I can tell what I'm working with - probably no one else can tell what I'm doing but it works for me. I am certain I am refering to the right text box in my code. I don't know all of the lingo - I am extremely new to Access and I don't have anyone to consult with but all of you (my IT dept dislikes Access).
Just in case I didn't reply correctly:
Private Sub Frame332_AfterUpdate()
Select Case Frame332.Value
Case 1
Psych.Value = "Yes"
Case 2
Psych.Value = "No"
End Select
End Sub
Thanks!
Jessica
There are some tips about how to debug code at http://www.tek-tips.com/faqs.cfm?fid=7148.
It would be interesting to find out which line causes the error message. What happens if you add a new, blank text box (nothing in the control source) to your form named "txtMyNewControl" and then changed your code to:
Private Sub Frame332_AfterUpdate()
Select Case Frame332.Value
Case 1
Me.txtMyNewControl = "Yes" 'Psych.Value = "Yes"
Case 2
Me.txtMyNewControl = "No" 'Psych.Value = "No"
End Select
End Sub
This might narrow down your problem to see if the value of Psych can be set or not.
Duane Hookom, MVP
MS Access
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Wed, 1 Oct 2014 14:11:41 -0700
Subject: [MS_AccessPros] Re: option group error message
Now I don't even know if i pushing the correct reply button. I apologize if you don't have the message history, I have it so I'm assuming you do.
"Psych" is a unique name for the text box which has as it's control source a text field. I try very hard to give everything a unique name so I can tell what I'm working with - probably no one else can tell what I'm doing but it works for me. I am certain I am refering to the right text box in my code. I don't know all of the lingo - I am extremely new to Access and I don't have anyone to consult with but all of you (my IT dept dislikes Access).
Just in case I didn't reply correctly:
Private Sub Frame332_AfterUpdate()
Select Case Frame332.Value
Case 1
Psych.Value = "Yes"
Case 2
Psych.Value = "No"
End Select
End Sub
Thanks!
Jessica
__._,_.___
Posted by: Crystal <strive4peace2008@yahoo.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (9) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar