473,397 Members | 1,950 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 software developers and data experts.

locking subforms

ken
Hi,
I have a form that depending on certain criteria locks all of the
subforms on this form. The problem is when the code unlocks the
subforms their "allowedits" "allowdeletions" and "allowadditions"
properties are set to "NO". I believe when the main form locks the
subforms it sets these "allow" properties to "no". But when the
subforms are unlocked the "allow" properties are not set back to "yes".
I have all this code in the oncurrent event. Depending on the record
that I'm in, the form is either locked or not.

Anyhow I tried setting the "allow" properties to yes during the unlock
opperation, but access gives me an error stating that the subforms
don't have the allow properties...

what am I doing wrong?

thanks

Nov 13 '05 #1
8 11485

"ken" <ge****@gmail.com> wrote in message
news:11**********************@g47g2000cwa.googlegr oups.com...
Hi,
I have a form that depending on certain criteria locks all of the
subforms on this form. The problem is when the code unlocks the
subforms their "allowedits" "allowdeletions" and "allowadditions"
properties are set to "NO". I believe when the main form locks the
subforms it sets these "allow" properties to "no". But when the
subforms are unlocked the "allow" properties are not set back to "yes".
I have all this code in the oncurrent event. Depending on the record
that I'm in, the form is either locked or not.

Anyhow I tried setting the "allow" properties to yes during the unlock
opperation, but access gives me an error stating that the subforms
don't have the allow properties...

what am I doing wrong?

thanks


Just a suggestion Ken, but if you post your code there's a much better
chance that someone will be able to tell you what is wrong with it.

Nov 13 '05 #2
ken
Private Sub Form_Current()
If ([islocked]) Then
'if true lock form
Me.AllowEdits = False
Me.AllowDeletions = False
Me.AllowAdditions = False
Me![Input subform].Locked = True
Else
'if false unlock form
Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = True
Me![Input subform].Locked = False
End If
End Sub
Basically when the if statement is false I could not do any data entry
on the subform. I could on the main form though...I was looking through
the properties while the form was on...and all the allow properties had
a "No" in them...so I tried this:

Private Sub Form_Current()
If ([islocked]) Then
'if true lock form
Me.AllowEdits = False
Me.AllowDeletions = False
Me.AllowAdditions = False
Me![Input subform].Locked = True
Else
'if false unlock form
Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = True
Me![Input subform].Locked = False
Me![Input subform].AllowEdits = True
End If
End Sub
And I got error stating that the Me![Input subform] does not have an
allowedits property...

Nov 13 '05 #3
doesn't look like you're referring to the subform properly. Here's an
article that gives examples of referring to just about everything in
forms and subforms.

http://www.mvps.org/access/forms/frm0031.htm

I think this is the syntax that you want:

Me!Subform1.Form.AllowEdits=True

Nov 13 '05 #4

"ken" <ge****@gmail.com> wrote in message
news:11**********************@g14g2000cwa.googlegr oups.com...
Private Sub Form_Current()
If ([islocked]) Then
'if true lock form
Me.AllowEdits = False
Me.AllowDeletions = False
Me.AllowAdditions = False
Me![Input subform].Locked = True
Else
'if false unlock form
Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = True
Me![Input subform].Locked = False
End If
End Sub
Basically when the if statement is false I could not do any data entry
on the subform. I could on the main form though...I was looking through
the properties while the form was on...and all the allow properties had
a "No" in them...so I tried this:

Private Sub Form_Current()
If ([islocked]) Then
'if true lock form
Me.AllowEdits = False
Me.AllowDeletions = False
Me.AllowAdditions = False
Me![Input subform].Locked = True
Else
'if false unlock form
Me.AllowEdits = True
Me.AllowDeletions = True
Me.AllowAdditions = True
Me![Input subform].Locked = False
Me![Input subform].AllowEdits = True
End If
End Sub
And I got error stating that the Me![Input subform] does not have an
allowedits property...


Ken, I'm only guessing here, but I suspect that the procedure you are using
is in the parent form, not the sub form. AllowEdits only applies to forms,
not controls on forms, even sub form controls. To allow edits you will need
to refer directly to the form with something like:

Forms![Input subform].AllowEdits = True

HTH

Nov 13 '05 #5
ken
ok I think that did it I have to do
Me![Input subform].Form.AllowEdits = True

then it works

Nov 13 '05 #6
ken
does anyone know though why when you lock the form with .locked = true
it sets all the allow properties to No, but when you unlock it does not
set them back to yes?

Nov 13 '05 #7
"ken" <ge****@gmail.com> wrote in
news:11**********************@z14g2000cwz.googlegr oups.com:
ok I think that did it I have to do
Me![Input subform].Form.AllowEdits = True

then it works


The reason it works is because there's a distinction between the
subform control that you place on a form and the actual subform
contained in the subform control.

If you turn off the wizards in form design, you can drop an empty
subform control on a form. It has no Source Object property.

The subform control has its own set of properties, separate from
those of the subform that it is holding once you assign a Source
Object property.

Versions of Access since 2000 obscure this because of the brain-dead
stupid interface that displays the subform in the control itself at
all times (making it impossible to easily edit that form in
instances where the size of the control is too small to fully
display the design view of the form; this includes EVERY SUBFORM
EVER, since the design view requires more screen real estate than
the form view in all cases), but it's still there.

Me![Input subform] is the subform control.

whereas:

Me![Input subform].Form is the form displayed in that subform
control.

I make a point of naming subforms subMyForm and the subform control
MyForm to remind myself that MyForm is *not* itself a form, but a
subform control.

--
David W. Fenton http://www.bway.net/~dfenton
dfenton at bway dot net http://www.bway.net/~dfassoc
Nov 13 '05 #8
gleave
5
Hi, I also have a problem with subforms but what I want to do is slightly different. I want to lock a subform until all the required data is inputted in the main form.

The required fields in main form:
Invoice Number
Invoice to

Thank you
Mar 29 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Evil | last post by:
Hi, i have a problem with a treeview and some subforms in MS Access97. I have a form with a treeview on the left side which lets me navigate thru some projects. Then on the right side, i have...
1
by: M Wells | last post by:
Hi All, I am developing an Access 2003 project application with the back end in SQL Server 2003. I have a master form that tracks projects, and several subforms on it that track various...
2
by: Jack | last post by:
Hi all, I searched the archives and found everyone happy with Stephen's MouseWheel On/Off code except for those with subforms. Stephen's page indicates that he has added code to handle subforms...
0
by: Jack | last post by:
Gday everyone, I'm dearly hoping Stephen Lebans is going to update his masterpeice to stop the mouse wheel scrolling to work on subforms *he has indicated this to me but of course beggers can't...
6
by: MS | last post by:
Access 97 here. I want a simple way to "lock" certain records on a form. Some records remain "live" until all data is available which happens over time. When all the fields are complete, I want...
1
by: ken | last post by:
Record locking is a form property which either locks the whole record when another user is accessing it, or just locks the cell that is being edited correct? I am looking for another record...
1
by: Moha | last post by:
I have form Orders and Subform Technical info. The Ordrs form is connected to query (multiple table) and the Technicl subform is connected to one table. I have divided the technical table into...
10
by: Ami | last post by:
Hello everyone, I have developed a small access application and now I need to lock my forms against unwanted edits. I have used the code by Allen Browne I found here...
1
by: haroonahmad | last post by:
I would really like to have the form come up locked, and then the user unlock it for changes, and then lock it again. I'm using Access 2003. I have no idea how to do it, but have seen it. ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.