Microsoft Access Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsDatabasesMicrosoft Access 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 February 11th, 2005, 09:06 AM
thompson thompson is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 6 thompson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 m 2 sec
Reputation Power: 0
Question Greying out command buttons

I have created a form, which has a number of command buttons on it. However, i dont want all the buttons to be able to be pressed until the selected information has been entered. For example, where a member decides to pay by their membership by direct debit - the bank details button should become active. If the condition is not met, it should remain inactive.

is it possible to 'grey out' command buttons until information has been entered into access? any information about how it is done would be massively appreciated.

Thompson
Comments on this post
kaiser disagrees!

Reply With Quote
  #2  
Old February 11th, 2005, 02:33 PM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
The easiest way would be to set the command buttons Enabled property to NO. Then in the After Update event of your controls you would enable those buttons you want to have the user to use.

CommandButton.Enabled = True

lwells
Comments on this post
kaiser disagrees!

Reply With Quote
  #3  
Old February 14th, 2005, 08:38 AM
thompson thompson is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 6 thompson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 m 2 sec
Reputation Power: 0
That helped enormously, and the command buttons work, however, is there a way of writing an if statement into it, so that when a family member is selected from a combo box (rather than any other value) the button can appear?

Reply With Quote
  #4  
Old February 14th, 2005, 10:56 AM
lwells lwells is offline
Contributing User
Dev Articles Novice (500 - 999 posts)
 
Join Date: Sep 2004
Posts: 632 lwells User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 Day 21 h 59 m 38 sec
Reputation Power: 5
Sure, just specify what that value is in your if statement.

If combobox = "FamilyMember" Then
CommandButton.Enable = True
Else
CommandButton.Enabled = False
End If

Just specify what the text value of your combo box is to determine whether to enable your command button. You will need to use the bound column of the combobox or specify which column to use.

lwells

Reply With Quote
  #5  
Old February 14th, 2005, 11:42 AM
thompson thompson is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2005
Posts: 6 thompson User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 29 m 2 sec
Reputation Power: 0
Thats worked a treat, thanks a lot for the help.

Reply With Quote
  #6  
Old April 1st, 2005, 06:34 PM
lasereye lasereye is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 1 lasereye User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 16 m 21 sec
Reputation Power: 0
Text boxes

is it possible to be able to grey out the command buttons, but as soon information is entered into both of the two required fields the buttons are activated. my code at the moment is as follows:

Sub JobButtonEnable()
If jobLocation.[Value] <> "" And jobContact.[Value] <> "" Then
[AddRecord].[Enabled] = True
[SaveRecord].[Enabled] = True
Else
[AddRecord].[Enabled] = False
[SaveRecord].[Enabled] = False
End If
End Sub

Then i use onChange to call the macro, but you always have to click out of the text box for it to detect that the value is more than null. I would like it so the user enters information into either the jobLocation or jobContact text box, then as soon as they begin typing data into the other box it activates the buttons, rather than when they tab out or click out of the text box, as the other information is not always required.

The closest remedy i have to my problem is to use a onTimer() with the interval being something quick like 1ms, so as soon as the user enters anything into the text box it is activated. Unfortunately this causes the buttons to flicker, so that really isnt the best solution unless it has to be.

Any ideas will be appreciated!

Reply With Quote
  #7  
Old April 22nd, 2005, 06:18 PM
camdec camdec is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2005
Posts: 3 camdec User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 48 m 27 sec
Reputation Power: 0
Text Boxes

Why don't you try putting code like below so that the user is put into the field you choose no matter what field they started in.

Try this it should work:-


Private Sub Form_Open(Cancel As Integer)
Forms!Form1!SaveRecord.Enabled = False
Forms!Form1!AddRecord.Enabled = False
End Sub


Private Sub Joblocation_Enter()
If (Eval("[Forms]![Form1]![Jobcontact] Is Not Null")) Then
Forms!Form1!SaveRecord.Enabled = True
Forms!Form1!AddRecord.Enabled = True
Else

DoCmd.GoToControl "Jobcontact"
End If
End Sub


Hope this helps!

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsDatabasesMicrosoft Access Development > Greying out command buttons


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


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





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway
Stay green...Green IT