473,387 Members | 1,365 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Command button press

365 100+
Hello again...

just a quicky (hopefully)

How do you set a command button's "special effect" to be sunk... using VB code.

i have 3 buttons that i want to "sink" the active button for the one that is active... like a toggle switch!
thanks

Dan
Dec 13 '07 #1
6 7373
Dan2kx
365 100+
NM found it in the help file, i did look before i posted but i expected it to be...

Me!cmb1.specialeffect = .....
but it is
Forms("frmStaffHols").Controls("cmb1").SpecialEffe ct = 2
if it works!
Dec 13 '07 #2
Dan2kx
365 100+
Ok it doesnt work for command buttons (everything else tho!!!)

so i still help from the pro's!!
Dec 13 '07 #3
missinglinq
3,532 Expert 2GB
What do you mean by "want to sink the active button for the one that is active?" If you mean, by active button, the last one to be clicked, then this hack will come close:

At any rate, what you'd have to do is to use textboxes as faux command buttons. Textboxes have a click event just like a button, and so they can be used to execute code.

In the Property Box format each textbox initially to look like a "normal" button. You can select all three and format them at the same time:

Special Effect
Raised
Back color (you must have the minus sign in front of the number)
-2147483633
Control Source
= "My Fake Button Caption"
Text Align
Center
Place a command button on the form, hit Cancel (it won't have code behind it because it doesn't do anything) and name it PhantomButton. Place it in the lefthand, bottom corner of your form, and shrink it as small as possible.

Then place this code behind the textboxes:
Expand|Select|Wrap|Line Numbers
  1. Private Sub TextBox1_Click()
  2.  TextBox1.SpecialEffect = 2
  3.  TextBox2.SpecialEffect = 1
  4.  TextBox3.SpecialEffect = 1
  5.  'Place code to be executed here
  6.  PhantomButton.SetFocus
  7. End Sub 
  8.  
  9. Private Sub TextBox2_Click()
  10.   TextBox1.SpecialEffect = 1
  11.   TextBox2.SpecialEffect = 2
  12.   TextBox3.SpecialEffect = 1
  13.   'Place code to be executed here
  14.   PhantonButton.SetFocus
  15.  End Sub 
  16.  
  17. Private Sub TextBox3_Click()
  18.   TextBox1.SpecialEffect = 1
  19.   TextBox2.SpecialEffect = 1
  20.   TextBox3.SpecialEffect = 2
  21.   'Place code to be executed here
  22.   PhantonButton.SetFocus
  23.  End Sub
Placing focus on PhantonButton takes the cursor away from the textbox cum button,; otherwise the cursor would blink on the "button" and destroy the illusion!

Linq ;0)>
Dec 13 '07 #4
NeoPa
32,556 Expert Mod 16PB
Ok it doesnt work for command buttons (everything else tho!!!)

so i still help from the pro's!!
Sunken; Raised; Flat; etc are sensible options for most controls.
As a button needs to use Sunken & Raised for its two different STATEs, it's not sensible to provide that option in its design. Does that make sense?
Dec 19 '07 #5
Minion
108 Expert 100+
Another way you can do this is to make a Label control with the button text and set the style to raised. Then take a transparent command button and lay it over top of the label. From there all you would need do is alter the label's properties when the button was pressed.

This is a great way of having more control over your buttons than access allows. As far as the user knows the button looks like whatever the label is set to look like.

Hope this helps

- Minion -
Dec 19 '07 #6
Dan2kx
365 100+
I am using a toggle switch now, thanks anyways

Dan
Dec 19 '07 #7

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

Similar topics

1
by: John Svercek | last post by:
On an aspx page, I notice when the page opens there is no default command button (press enter & nothing happens). However, once I set the focus on a text field one of the command buttons becomes...
8
by: William Bradley | last post by:
Following is the code I am using, behind a command button, on a form to print out only the report of that particular form. ******************** Code Start ************************ Dim strDocName...
6
by: deko | last post by:
I have a several forms that accept user input in a textbox and then take some action based on that input after a command button is clicked. Is it possible issue the command when the user presses...
2
by: Johm | last post by:
I need some help in finding a way to remove the filter from the previous command. I open the report from a form where i have option group called Office.Depending on the option in the option...
16
by: MLH | last post by:
In Access 97 and Access 2.0 applications, if a command button has the focus, the spacebar will 'PRESS" the key. How does one go about disabling this annoying BEATURE?
3
by: C# Learner | last post by:
Is it possible to set a command button to the "default" button of the form? Here's an example of what I mean -- press Start -> Run. Notice that the "OK" button has a dark rectangle around it,...
0
by: aviklund | last post by:
Hi, I made a simple data access page with a search button that does work properly, but now I would like to add a filtering to the command button also. Ideal solution would be like this: ...
0
by: mittal | last post by:
i m new in asp.net 2005.i worked be4 in 2003.i cant get how to get item command event in 2005.i know its available in 2005 named rowdatabound event but i wanna do it on EDIT button.i wanna...
1
by: RyanT | last post by:
Access 2000 Windows XP I have a small form with two text boxes: - User ID - Password The form also has two command buttons: - Login - Cancel
9
by: supun24 | last post by:
Hi All, I have created Command Array like follows. Public Class Form1 Dim NewButton(25) As Button Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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...

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.