By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,376 Members | 1,537 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,376 IT Pros & Developers. It's quick & easy.

change form property using SetValue

P: n/a
Hey,

I am using SetValue to change the DataEntry property of a form to
"YES". But It doesn't work. No error messages, but the property didn't
change.Following is the what I am writing
SetValue:
Item: [Forms]![SubHistory]![Form].DataEntry
Expression:Yes

Does anyone know what is wrong? Thanks.

Mindy

Dec 6 '05 #1
Share this Question
Share on Google+
6 Replies


P: n/a
Is SubHistory a subform?

If so, you will need to get at it through the main form, e.g.:
Forms!YourMainForm!SubHistory.Form.DataEntry

If not, drop the .Form bit:
Forms!SubHistory.DataEntry

If the record is dirty, you may need to save the record first.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mindy" <ma************@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...

I am using SetValue to change the DataEntry property of a form to
"YES". But It doesn't work. No error messages, but the property didn't
change.Following is the what I am writing
SetValue:
Item: [Forms]![SubHistory]![Form].DataEntry
Expression:Yes

Does anyone know what is wrong? Thanks.

Mindy

Dec 6 '05 #2

P: n/a
Allen,

SubHistory is a subform and I try the one you suggested for subform,
and here is the error message I get when I run forms:

The object you referenced in the visual basic procedure as an OLE
object isn't an OLE object.

Do you have any idea of this? Thanks.

Mindy

Allen Browne wrote:
Is SubHistory a subform?

If so, you will need to get at it through the main form, e.g.:
Forms!YourMainForm!SubHistory.Form.DataEntry

If not, drop the .Form bit:
Forms!SubHistory.DataEntry

If the record is dirty, you may need to save the record first.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mindy" <ma************@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...

I am using SetValue to change the DataEntry property of a form to
"YES". But It doesn't work. No error messages, but the property didn't
change.Following is the what I am writing
SetValue:
Item: [Forms]![SubHistory]![Form].DataEntry
Expression:Yes

Does anyone know what is wrong? Thanks.

Mindy


Dec 6 '05 #3

P: n/a
The message suggests that something has the wrong name.

You might open the main form in design view, right-click the subform, and
choose Properties? What is in its Name property? The Name of the subform
control may not be the same as the name of the form that is loaded into the
control (its SourceObject.)

What confuses me, though, is that you said you were using SetValue, so I
assume you are using a macro. Yet the error message refers to a visual basic
procedure. You may well have more than one problem here.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mindy" <ma************@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
Allen,

SubHistory is a subform and I try the one you suggested for subform,
and here is the error message I get when I run forms:

The object you referenced in the visual basic procedure as an OLE
object isn't an OLE object.

Do you have any idea of this? Thanks.

Mindy

Allen Browne wrote:
Is SubHistory a subform?

If so, you will need to get at it through the main form, e.g.:
Forms!YourMainForm!SubHistory.Form.DataEntry

If not, drop the .Form bit:
Forms!SubHistory.DataEntry

If the record is dirty, you may need to save the record first.

"Mindy" <ma************@yahoo.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
>
> I am using SetValue to change the DataEntry property of a form to
> "YES". But It doesn't work. No error messages, but the property didn't
> change.Following is the what I am writing
> SetValue:
> Item: [Forms]![SubHistory]![Form].DataEntry
> Expression:Yes
>
> Does anyone know what is wrong? Thanks.
>
> Mindy

Dec 7 '05 #4

P: n/a
Sorry, I didn't explain it clearly. The forms!formname!controlname of
setvalue is for setting up value of a control. What I want here is
different.

when we chose a form property, we will see form/data/event/other/all,
and under "data" there is Record Source, Filter, ..., Allow Edit, ...,
what I want is after a user hit one button, the "Allow Edit" property
will be changed from "NO" to "YES."

Thanks.

Mindy

Dec 7 '05 #5

P: n/a
Okay, we are going to build this reference a step at a time.

1. Make sure this form is open.

2. Press Ctrl+G to open the Immediate window.

3. Enter:
? Forms![YourMainForm].Name
substituting the name of your main form in brackets.
When you press Enter, Access should show the name.

4. Once you have that working you can try to get the reference to the
subform. On a fresh line in the Immediate window, try:
? Forms![YourMainForm]![SubHistory].Form.Name
If that responds with SubHistory, the reference is correct.
If not, then the subform control is named something different.

5. Once that is working, try:
? Forms![YourMainForm]![SubHistory].Form.AllowEdits
Access should respond with either True or False.

6. Once that is working, you can copy the expression (without the question
mark), and paste it into your macro below the SetValue action.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mindy" <ma************@yahoo.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Sorry, I didn't explain it clearly. The forms!formname!controlname of
setvalue is for setting up value of a control. What I want here is
different.

when we chose a form property, we will see form/data/event/other/all,
and under "data" there is Record Source, Filter, ..., Allow Edit, ...,
what I want is after a user hit one button, the "Allow Edit" property
will be changed from "NO" to "YES."

Thanks.

Mindy

Dec 8 '05 #6

P: n/a
Thanks a lot. It's very helpful. And it works now. Mindy
Allen Browne wrote:
Okay, we are going to build this reference a step at a time.

1. Make sure this form is open.

2. Press Ctrl+G to open the Immediate window.

3. Enter:
? Forms![YourMainForm].Name
substituting the name of your main form in brackets.
When you press Enter, Access should show the name.

4. Once you have that working you can try to get the reference to the
subform. On a fresh line in the Immediate window, try:
? Forms![YourMainForm]![SubHistory].Form.Name
If that responds with SubHistory, the reference is correct.
If not, then the subform control is named something different.

5. Once that is working, try:
? Forms![YourMainForm]![SubHistory].Form.AllowEdits
Access should respond with either True or False.

6. Once that is working, you can copy the expression (without the question
mark), and paste it into your macro below the SetValue action.

--
Allen Browne - Microsoft MVP. Perth, Western Australia.
Tips for Access users - http://allenbrowne.com/tips.html
Reply to group, rather than allenbrowne at mvps dot org.

"Mindy" <ma************@yahoo.com> wrote in message
news:11**********************@g49g2000cwa.googlegr oups.com...
Sorry, I didn't explain it clearly. The forms!formname!controlname of
setvalue is for setting up value of a control. What I want here is
different.

when we chose a form property, we will see form/data/event/other/all,
and under "data" there is Record Source, Filter, ..., Allow Edit, ...,
what I want is after a user hit one button, the "Allow Edit" property
will be changed from "NO" to "YES."

Thanks.

Mindy


Dec 9 '05 #7

This discussion thread is closed

Replies have been disabled for this discussion.