Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
|
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 29th, 2005, 05:07 AM
Friend of Wrox
 
Join Date: Mar 2005
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to disable subform untill values selected in m

How to disable subform untill values selected in main form?

Hi every body . I got a a form and sub form. I want to disable sub form untill the user finishes selecting values from combo box drop downboxes. I be happy if some one show me how to do this.


http://i5.photobucket.com/albums/y18...blesubform.jpg

(form picture)
 
Old June 29th, 2005, 05:54 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

Set the subform property called "Enabled" to "no", do this in design view.
Then put something like:

me.subform.enabled = Yes

in whatever combobox validation you have, so that when your user selects a record in the combobox it will "enable" the subform. You will probably want to refresh the data in your subform too.
 
Old June 29th, 2005, 06:33 AM
Friend of Wrox
 
Join Date: Mar 2005
Posts: 264
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
quote:Originally posted by leehambly
 Set the subform property called "Enabled" to "no", do this in design view.
Then put something like:

me.subform.enabled = Yes

in whatever combobox validation you have, so that when your user selects a record in the combobox it will "enable" the subform. You will probably want to refresh the data in your subform too.
Thank u for u reply. Well i got 3 combot boxes in my main form . Should i place the me.subform.enabled =yes inside code of each one of them ? Furthermore, could u tell me how to refresh my data in subfor? why do i need to do that. I only want it to display when the value for last combo box is selected by the user.Thanks


code behind the main form:
Code:
Option Compare Database

Private Sub CboEmployeeNo_AfterUpdate()
''pastse value of selected combo box to text label
Me.TxtEmployeeName = Me.CboEmployeeNo.Column(1)

End Sub

Private Sub CboYearWeek_AfterUpdate()

Me.TextWeekNo = Me.CboYearWeek.Column(0)
End Sub

Private Sub TextYear_AfterUpdate()
Me.TextYear = Me.CboYear.Column(1)
End Sub
 
Old June 29th, 2005, 07:22 AM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 155
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to leehambly
Default

Seriously, and this is only a personal perspective, but I think you really need to invest in a "How Databases works" book as well as a VB and Access book.

Ok, where you disable and enable the subform is totally up to you and how you want it work. If you want to trigger the enable from 3 combos, then go for it.

Why would you need to refresh... Im not entirely sure you would need to refresh, I merely said you would probably want to. The subform data is related to your comboboxes? I assume it is, but then I spose it doesnt have to be! If it is related to your comboboxes and the subform is disabled while you have been playing with the comboboxes, no doubt when you enable the subform it would be a good idea to refresh the data, wouldnt it? Test it out, see whether you need it.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Update field on all selected records in a subform S300570 Access 1 January 14th, 2008 02:19 PM
How to highlight selected dropdown values. sheetm J2EE 0 June 5th, 2007 05:04 AM
Disable fields in a subform ltdavecass Access VBA 4 January 31st, 2007 09:43 PM
refer to subform values stepdev Access VBA 2 December 7th, 2006 12:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.