Jessica,
The "Me." is only used in VBA to refer to objects in a form or report. For instance, if you have a combo box named "cboStatus" on your form, the vba/code behind the form should reference the control like:
Me.cboStatus
Not all of your fields need to be on the same horizontal row (single or continuous form). This also suggests you might have un-normalized tables. Typically a table has fewer than 20 fields. There are some circumstances where more fields might be needed. A properly normalized database application has more tables and records with fewer fields in any table.
Make sure you ask questions about your tables and normalization if you don't understand. It would help if you posted some of your table and field names.
Duane Hookom MVP
MS Access
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Fri, 3 Oct 2014 14:17:32 -0700
Subject: Re: [MS_AccessPros] Re: option group error message
Thanks everyone. I got it fixed. Apparently I had a problem in my table so I deleted the problem field and created a completely new one and it's fine now. I will rename my frames from here on out which leads to another stupid question: what is the significance of Me. when naming controls?
And another question: Apparently I won't be able to make my form long enough to include all of the fields I will need. Is a subform the best (AKA: easiest) way to get all of the information on one form? If so, can I still keep all of the fields in the same table or should there be a different table for each form? I'm hoping to keep this as simple as possible since I have only a basic understanding of Access.
Thanks,
Jessica
---In MS_Access_Professionals@yahoogroups.com, <strive4peace2008@...> wrote :
The "Me." is only used in VBA to refer to objects in a form or report. For instance, if you have a combo box named "cboStatus" on your form, the vba/code behind the form should reference the control like:
Me.cboStatus
Not all of your fields need to be on the same horizontal row (single or continuous form). This also suggests you might have un-normalized tables. Typically a table has fewer than 20 fields. There are some circumstances where more fields might be needed. A properly normalized database application has more tables and records with fewer fields in any table.
Make sure you ask questions about your tables and normalization if you don't understand. It would help if you posted some of your table and field names.
Duane Hookom MVP
MS Access
To: MS_Access_Professionals@yahoogroups.com
From: MS_Access_Professionals@yahoogroups.com
Date: Fri, 3 Oct 2014 14:17:32 -0700
Subject: Re: [MS_AccessPros] Re: option group error message
Thanks everyone. I got it fixed. Apparently I had a problem in my table so I deleted the problem field and created a completely new one and it's fine now. I will rename my frames from here on out which leads to another stupid question: what is the significance of Me. when naming controls?
And another question: Apparently I won't be able to make my form long enough to include all of the fields I will need. Is a subform the best (AKA: easiest) way to get all of the information on one form? If so, can I still keep all of the fields in the same table or should there be a different table for each form? I'm hoping to keep this as simple as possible since I have only a basic understanding of Access.
Thanks,
Jessica
---In MS_Access_Professionals@yahoogroups.com, <strive4peace2008@...> wrote :
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@... [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
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
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: Duane Hookom <duanehookom@hotmail.com>
Reply via web post | • | Reply to sender | • | Reply to group | • | Start a New Topic | • | Messages in this topic (11) |
.
__,_._,___
Tidak ada komentar:
Posting Komentar