473,809 Members | 2,469 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Not allowing edit in a main form disabling edits in a subform

222 New Member
Dear Friend


Working on access 2007 sp2.

My form is consisting from a form and a subform.

while i am using the alowedits=no option on the property of the main form it is preventing me to edit my subform.

Is there any method where I will be able to stop edit in the main form while the subform still editable ?

I don't want to go through VBA because I do have many attributes and action on this forms...

Thank you in advance

Regards
Oct 27 '09 #1
8 10389
NeoPa
32,579 Recognized Expert Moderator MVP
Wassim, Your question seems to be the opposite of the title. What is it you're asking about exactly?
Oct 27 '09 #2
wassimdaccache
222 New Member
Sorry About the subject I was trying to say
while I disable edit in the main form, access is disabling edits in the subform too

the question is:

Is there any method where I will be able to stop edit in the main form while the subform still editable ?

Thank you
Oct 27 '09 #3
missinglinq
3,532 Recognized Expert Specialist
You'll need to loop thru the controls on the main form, and if the control type is not subform, lock it.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Form_Load()
  2. Dim ctrl As Control
  3.  
  4. For Each ctrl In Me.Controls
  5.  If (TypeOf ctrl Is TextBox) Or (TypeOf ctrl Is ComboBox) Then
  6.    ctrl.Locked = True
  7.  End If
  8. Next
  9.  
  10. End Sub
This locks textboxes and comboboxes, if you have other controls on the main form that need locking, you simply add them to the

If (TypeOf ctrl Is TextBox) Or (TypeOf ctrl Is ComboBox)

line in a like manner.

Linq ;0)>
Oct 27 '09 #4
Megalog
378 Recognized Expert Contributor
Go to the subform's form properties, and be sure the Allow Edits is set to YES.
I just tested this on a new form/subform and it worked fine with the main form locked down, but I had to then change the subform's property back to allow edits there.

If you are locking down the main form with VBA, then basically follow that statement with another line to ENABLE the edits for the subform. It may be that access is automatically propogating that property from the main form, to the subform?
Oct 27 '09 #5
missinglinq
3,532 Recognized Expert Specialist
If AllowEdits is set to No on the main form, then no control on the main form can be editied, including the subform control! That's why the only way to handle this is as I've suggested. You have to lock all controls on the main form except the subform control.

Linq ;0)>
Oct 27 '09 #6
Megalog
378 Recognized Expert Contributor
I stand corrected, Linq is right as usual ;)

I could've sworn I had it working in a test db.. then I created one from scratch and couldnt get it to work as I had said.
Oct 27 '09 #7
wassimdaccache
222 New Member
Thanks all. I am doing the loop to lock all my control..

Regards
Oct 28 '09 #8
missinglinq
3,532 Recognized Expert Specialist
Glad we could help!

Linq ;0)>
Oct 28 '09 #9

Sign in to post your reply or Sign up for a free account.

Similar topics

0
1400
by: ethanj /personal/ | last post by:
I have main form with subform, similar to the Order Details form in the Northwind database. The the main form record locking is released when I click to edit subform's records. Is there away to maintain the lock on the main form throughout, until the form is closed? Ethan
4
7024
by: Dave Boyd | last post by:
Hi, I have two very similar forms each with a subform. The main form gets a few fields from the user and passes this back to a query that the subform is bound to. The requery is done when the user enters the last qualifying field on the main form. In one case this works fine, the subform shows the data the user wants to update -- which means showing all the data put in previously (ie showing this via the requery and the continuous...
1
1810
by: gleave | last post by:
Hi, I have a problem with subforms. 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 The main form is called: Invoicing And the subform is called:
0
1600
by: theBman | last post by:
I have 2 tables. One master, one child using Access 2003 (PC) Have 2 forms. The main form is continuous while the sub is datasheet. I can filter on the main form and the subform filters with it. No problem. My goal is to be able to filter on the subform and have the main form filtered with it. Thought it would be simple but I for a week solid I have not been able to solve this on my own. I have review a zillion websites and still...
2
3972
by: stpark22 | last post by:
Hello, I've constructed a form that contains a subform in Access 2003. I want to be able to set the tab order to tab through the fields of the main forms then tab through the fieldw of the subform and then back to the main form. However, the subform tabs wont move beyond the subform once the cursor reaches the subform. Is there anyway to alter this?
3
1443
by: MGC | last post by:
I am using MS Access 97. I am trying create a log of record set additions to a table containing product inventory locations. Would like to add the date and time stamp to the just-saved data in the main table and record the transaction in a new table. I am trying to use a subform from in the main data entry form. The subform displays the information I want to record but I do not know how to save the results of the subform. Any help...
1
2868
by: kinglioness | last post by:
Hello All, I am new to this forum so I apologize if this quesiton was asked already. Although i did search but i couldn't find. I have 2 combo boxes one unbound and the other bound they are on the main form. One (combo box) filters the other. I would like for both boxes to filter the subforms which by the way are on tab controls I have 8 pages. I am very new to vba, but I am trying to get a code that will filter whatever subform is...
27
29293
by: tragaz | last post by:
Hi There, I'm a beginer in Access and VB. In my Database, I've got a form with a subform. the subform is a query from a table different than the table of the main form. those tables don't have a link yet. the main form is being use to create a new entry/ a new row in the table. What I want to do is use the primery key from the main form and copy the value in a field in the subform. In the subform, I first need to select some rows. The...
0
9603
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10378
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...
1
10391
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10121
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...
1
7664
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5550
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
5690
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4333
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
3
3015
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.