Database Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesDatabase Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 29th, 2009, 01:57 PM
Bijaya Bijaya is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 16 Bijaya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 54 m 23 sec
Reputation Power: 0
Access 2007 Combo Box within Form

Hi There,

I'm a bit of a novice in terms of access 2007 and know nothing about VBA. I was hoping someone could help me out with

I have created a table called Membership. It's fields include firstname, lastname, address, telnumber, Membership_Type and Group_Membership_ Type etc .

I have also created a form from this table. In this form Membership_Type and Group_Membership_Type are Combo Box. Their Row sources are (Individual and Group) and
( Collerative, sustaining and patron) respectively.

I want to make "Group_Membership_Type " visible only when Membership_type = "Group"

To accomplish this I have written code at the change event of membership_Type

Like this :

Private Sub Membership_Type_Change()


If [ Membership].[Membership Type] = "Group" Then


[ Membership].[Collective Membership Type].Visible = "true"

Else
[ Membership].[Collective Membership Type].Visible = "false"

End If
End Sub


I am not able to get the result.

Can someone please tell me how it's done? sorry if it sounds a little simple to some of you, but it your reply would be very helpful.

thanks

Reply With Quote
  #2  
Old January 29th, 2009, 05:01 PM
AlanSidman's Avatar
AlanSidman AlanSidman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2008
Location: Lake County, IL
Posts: 139 AlanSidman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 36 m 14 sec
Reputation Power: 1
Posted in error

Reply With Quote
  #3  
Old January 30th, 2009, 10:15 AM
AlanSidman's Avatar
AlanSidman AlanSidman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2008
Location: Lake County, IL
Posts: 139 AlanSidman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 36 m 14 sec
Reputation Power: 1
Code:
Like this :

Private Sub Membership_Type_Change()


If [ Membership].[Membership Type] = "Group" Then


[ Membership].[Collective Membership Type].Visible = "true"

Else
[ Membership].[Collective Membership Type].Visible = "false"

End If
End Sub


Think you need to change to AfterUpdate event and
Code:
If me.membership_Type ="Group" Then
me.Collective_Membership_Type.visible= True
Else
me.Collective_Membership_Type.visible = False
End if


A suggestion for field names. Avoid using spaces in field names. It will only cause aggravation in the future. You need to remember to either square bracket or use underlines. If you use a convention like MembershipType or CollectiveMembershipType you are less likely to have coding issues in the future.

Alan

Reply With Quote
  #4  
Old February 2nd, 2009, 06:03 PM
Bijaya Bijaya is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 16 Bijaya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 54 m 23 sec
Reputation Power: 0
Access 2007 combo Box Within Form

Alan, Thank for the suggestion. Code works fine, but I like to know why I need to use "Afterupdate" event.



Thank you
Bijaya

Reply With Quote
  #5  
Old February 3rd, 2009, 11:57 AM
AlanSidman's Avatar
AlanSidman AlanSidman is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Nov 2008
Location: Lake County, IL
Posts: 139 AlanSidman User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 36 m 14 sec
Reputation Power: 1
I use afterupdate because I want the script to fire after I move to the next control, ie. leave the control that has the script.

Alan
__________________
Alan Sidman
__________
If I helped you, I'd like to know. Click on the icon next to the thread number and tell me.

Reply With Quote
  #6  
Old February 16th, 2009, 04:07 PM
Bijaya Bijaya is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2009
Posts: 16 Bijaya User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 54 m 23 sec
Reputation Power: 0
Access 2007 ComboBox Within Form

Thank you AlanSidman for your tesponse.

Bijaya

Reply With Quote
  #7  
Old July 30th, 2009, 06:35 PM
thomas398 thomas398 is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2009
Posts: 1 thomas398 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 32 sec
Reputation Power: 0
Combo box on subform

I'm new to access 2007 forms and I'm sure this is an easy question

I want to pick a program in one box, the other box gives the matching price. The boxes are on a subform bound to an invoice table. The program-price combinations are on a seperate lookup table (thec_Program).

This code works on the subform on the price box:
SELECT THEC_Program.Program_Cost, THEC_Program.ID, THEC_Program.Program
FROM THEC_Program
WHERE (((THEC_Program.ID)=[Forms]![SUBFORMNAME]![Program]));

When a tab in the main form get a parameter error, so changed to this

SELECT THEC_Program.Program_Cost, THEC_Program.ID, THEC_Program.Program
FROM THEC_Program
WHERE (((THEC_Program.ID)=[Forms]![FORMNAME]![Program]));
I'm new to access 2007 forms and I'm sure this is an easy question:



I want to make a selection in one combo box and have the other show the matching info (program => program_cost). The bound boxes are on a subform for an invoice table. The program-price combinations are on a seperate lookup table Thec_Program.



This code on the program_cost box works when only the subform is open :



SELECT THEC_Program.Program_Cost,THEC_Program.Program,
THEC_Program.ID
FROM THEC_Program
WHERE (((THEC_Program.ID)=[Forms]![SUBFORMNAME]![Program]));


When the full form is open, the subform is a tab and the above code returns a parameter error it doesnt recognize the subformname.

So I chage to this:

SELECT THEC_Program.Program_Cost, THEC_Program.ID, THEC_Program.Program
FROM THEC_Program

WHERE (((THEC_Program.ID)=[Forms]![FORMNAME]![Program]));

No parameter error but the drop down is blank.... Why is query coming back blank?

I have an AFTERUPDATE on the program box. On the subform this allows for multiple changes.

Private Sub Program_AfterUpdate()
Me.Program_Cost = Null
Me.Program_Cost.Requery
Me.Program_Cost = Me.Program_Cost.ItemData(0)
Thanks for any help.


Thanks for any help.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesDatabase Development > Access 2007 Combo Box within Form


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 5 Hosted by Hostway
Stay green...Green IT