473,756 Members | 3,111 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 11518

"ken" <ge****@gmail.c om> wrote in message
news:11******** **************@ g47g2000cwa.goo glegroups.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.AllowDeletio ns = False
Me.AllowAdditio ns = False
Me![Input subform].Locked = True
Else
'if false unlock form
Me.AllowEdits = True
Me.AllowDeletio ns = True
Me.AllowAdditio ns = 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.AllowDeletio ns = False
Me.AllowAdditio ns = False
Me![Input subform].Locked = True
Else
'if false unlock form
Me.AllowEdits = True
Me.AllowDeletio ns = True
Me.AllowAdditio ns = 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.For m.AllowEdits=Tr ue

Nov 13 '05 #4

"ken" <ge****@gmail.c om> wrote in message
news:11******** **************@ g14g2000cwa.goo glegroups.com.. .
Private Sub Form_Current()
If ([islocked]) Then
'if true lock form
Me.AllowEdits = False
Me.AllowDeletio ns = False
Me.AllowAdditio ns = False
Me![Input subform].Locked = True
Else
'if false unlock form
Me.AllowEdits = True
Me.AllowDeletio ns = True
Me.AllowAdditio ns = 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.AllowDeletio ns = False
Me.AllowAdditio ns = False
Me![Input subform].Locked = True
Else
'if false unlock form
Me.AllowEdits = True
Me.AllowDeletio ns = True
Me.AllowAdditio ns = 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.AllowEdit s = 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.c om> wrote in
news:11******** **************@ z14g2000cwz.goo glegroups.com:
ok I think that did it I have to do
Me![Input subform].Form.AllowEdit s = 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 New Member
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
4004
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 several Tabs, each with a subform. Now, my tree view nodclick code goes like: sProjNum = me.tvwX.SelectedItem.Key
1
2992
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 aspects of the project. On the masterform I have two unbound listboxes that I populate with information regarding the current record in one of the subforms.
2
3003
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 ("Bug Fix for SubForms with ScrollBars. Bug fix for SubForms without visible ScrollBars.") - BUT I still can't get it to work on my app with my subforms. I'm using Access 2000, It works fine on the main forms but not on the
0
2244
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 be choosers here so I have no idea when this would be done*. I'm just wondering if anyone has gotten around the problem some other way? --Original Thread---
6
2797
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 the record to be able to be "locked", or intentionally unlocked. I thought of having a check box called "chkedit" that can be clicked when the data entry for the record is complete. I have the following code in the OnCurrent event for the...
1
1537
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 lock. I want to lock all records on a form, in VBA. Anotherwords like turning on the locked property. Is there a way I can do this all at once for all the records on my form including subforms? Thanks
1
1870
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 multiple subforms and each subform has its owm fields according to the workflow in the company. Creating technical information is first form, then filling dispatched serial numbers to the dispatched material is another subform and then adding field...
10
2975
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 http://allenbrowne.com/ser-56.html and it works great, but I need to unlock and lock my main form and subform separately, using two different buttons.
1
5060
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. Thanks.
0
9325
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9930
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9716
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9571
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
4996
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5180
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3676
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3185
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2542
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.