473,793 Members | 2,974 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

toggle button caption on continuous form

n8kindt
221 New Member
i have a continuous form that i want a toggle button to display "on" or "off." everything i try changes every single caption on the continuous form--rather than the single row. here's what i have so far:
Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Paint()
  2. If OnOff.Value = True Then
  3. OnOff.Caption = "On"
  4. Else: OnOff.Caption = "Off"
  5. End If
  6. End Sub
it works, but every time the mouse moves over the button, the button flickers. this is not as clean as i would like it to be but if nothing else comes up, i suppose i can live with it.
Apr 10 '08 #1
7 7032
FishVal
2,653 Recognized Expert Specialist
Hi, there.

The problem is that the buttons in different rows are just one single control. You could not change an appearance of the button in <all rows.
A workaround here may be bound ToggleButton control, which certainly requires additional field in the linked table to be bound to.

Regards,
Fish
Apr 10 '08 #2
n8kindt
221 New Member
Hi, there.

The problem is that the buttons in different rows are just one single control. You could not change an appearance of the button in <all rows.
A workaround here may be bound ToggleButton control, which certainly requires additional field in the linked table to be bound to.

Regards,
Fish
i'm sorry, i forgot to mention that it was indeed bound. i think i'm going to have to settle with the "flickering " for now. one small problem with this however, is when i delete a record i get runtime error 2424. "the expression you entered has a field, control, or property name that access cannot find." if i click end twice (since the error pops up twice), it works fine. so how do i bypass this error using the code i already have?
Apr 10 '08 #3
n8kindt
221 New Member
Expand|Select|Wrap|Line Numbers
  1. If DataErr = 2424 Then
  2.         Response = acDataErrContinue
  3. End If
i've got this much... where do i place the code??
Apr 10 '08 #4
n8kindt
221 New Member
Expand|Select|Wrap|Line Numbers
  1. If DataErr = 2424 Then
  2.         Response = acDataErrContinue
  3. End If
i've got this much... where do i place the code??

this is my final code. i realize i may not have been clear about my problem up above. the code i am listing below is the only solution i have to the problem of every single caption changing whenever one is changed in a continuous form. everything works great now except for a flicker whenever the mouse is moved over the button.

Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Paint()
  2.  
  3. On Error GoTo PROC_ERR
  4. If Not IsNull(Apply1.Value) Then
  5.     If OnOff.Value = True Then
  6.     OnOff.Caption = "On"
  7.     Me.Dirty = False
  8.     Else: OnOff.Caption = "Off"
  9.     End If
  10. Else: Exit Sub
  11. End If
  12. PROC_ERR:
  13.   On Error Resume Next
  14. End Sub
can anyone help with the flicker problem?
Apr 15 '08 #5
n8kindt
221 New Member
minor correction to the above code:

Expand|Select|Wrap|Line Numbers
  1. Private Sub Detail_Paint()
  2. On Error GoTo PROC_ERR
  3. If Not IsNull(OnOff.Value) Then
  4. If OnOff.Value = True Then
  5. OnOff.Caption = "On"
  6. Me.Dirty = False
  7. Else: OnOff.Caption = "Off"
  8. End If
  9. Else: Exit Sub
  10. End If
  11. PROC_ERR:
  12. On Error Resume Next
  13. End Sub
Apr 15 '08 #6
FishVal
2,653 Recognized Expert Specialist
Hi, there.

You use Detail_Paint event which I could not find in Access 2003.
This makes me think you are using Access 2007.
If so, then you may take advantage of bound Image control to mimick toggle button.

In form RowSource:
Expand|Select|Wrap|Line Numbers
  1. SELECT ..., iif(OnOff, "X:\...\OnButtonFace.bmp", "X:\...\OffButtonFace.bmp") AS txtPathToButtonFace FROM ....
Image control is bound to [txtPathToButton Face].

Image_Click event handler inverts [OnOff].Value.

Button faces may be grabbed directly from screen. ))

Unfortunately (or maybe fortunately :)) I have no Access 2007. If you does and want to give it a try, then code debugging is all upon you.

Regards,
Fish
Apr 16 '08 #7
n8kindt
221 New Member
Hi, there.

You use Detail_Paint event which I could not find in Access 2003.
This makes me think you are using Access 2007.
If so, then you may take advantage of bound Image control to mimick toggle button.

In form RowSource:
Expand|Select|Wrap|Line Numbers
  1. SELECT ..., iif(OnOff, "X:\...\OnButtonFace.bmp", "X:\...\OffButtonFace.bmp") AS txtPathToButtonFace FROM ....
Image control is bound to [txtPathToButton Face].

Image_Click event handler inverts [OnOff].Value.

Button faces may be grabbed directly from screen. ))

Unfortunately (or maybe fortunately :)) I have no Access 2007. If you does and want to give it a try, then code debugging is all upon you.

Regards,
Fish
thanks for your advice. yes, i am running access 2007 so i will give your suggestion a go and post back with my results.
Apr 16 '08 #8

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

Similar topics

3
6781
by: David | last post by:
Hi, I need a button shown for each record (cont. form) with specific captions on each. I have a notes form for each record. When a user presses the button they can read the notes. I want to display a caption on the button to state either "Order Notes" or "READ NOTES". I placed a label over the button, and depending if the notes field is
11
4817
by: MLH | last post by:
Why is that? If I choose the tiny check boxes which are hard to hit with a mouse, it works fine. But option buttions, shich can be sized big enough for people with limited sight and dexterity to hit - they don't work at all. Its true. I created 'em with the built-in wizard furnished with Access 97 but they do not work. I put 12 of 'em in the group, labeled the months of the year and giving
4
4352
by: Neil Coleclough | last post by:
I am constructing a database to process product returns for my Company. I have a number of toggle buttons to identify the stage to which each return has been processed. For example, clicking the first button confirms that the goods are now in our building awaiting initial processing. This button then fires off an email to our warehouse staff alerting them to the fact. I want to restrict these buttons to single use, so that once the email...
5
5433
by: Wonder | last post by:
How can I create or use the msgobx to show a message without a default button. The user has explicity to click on the button, so the msgbox closes it. Thanks,
2
11425
by: John Smith | last post by:
How can I use a transparent command button to change a checkbox? I have my records set up in a continuous form and I want theuser to be able to click on the record and have this toggle the "Print" checkbox. the command button would be set up as transparent and cover the entire record.
3
5328
by: afr0ninja | last post by:
Hello! I'm currently working on a form that has several input fields and a subform. What I'm trying to accomplish is that when I first open the form I'd like to have the input fields displayed only. The fields are about 3" wide. Then I'd like to have a command button that when pushed it would expand the form to about 9" displaying the subform along with the input fields. The command button could then be pressed again to shrink the...
1
4441
by: Jeffrey Christiansen | last post by:
I wanted to add a toggle button to a VB2005 form to be used for a simple Windows Application (i.e. compiled to a "*.exe"), so I added the ActiveX Microsoft Forms Object toggle button, however I can't get this button does work properly. The documentation I found in the FM20.CHM files says the button state can be determined from its "Value" property, but the property list shown in VB2005 does not have a "Value" property. How is the button...
7
2121
by: dkohel | last post by:
I have a form that returns 100 items. All of the items have have a different value in their Category field. EXAMPLE: ---------------- A B C How can I change the value of the caption in the field label on the
2
6951
by: 6afraidbecause789 | last post by:
Hi - Has anyone ever used toggle buttons to select items in a listbox? I'd like to put about 24 toggle buttons on an unbound form that select or deselect items in a multiple select listbox. I've come across a way to set the listbox value to only 1 at a time, but need multiple toggle buttons to be on their corresponding listbox item values to be selected. Thanks!
0
9518
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
10430
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10211
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...
0
10000
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...
0
9033
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7538
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
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
4111
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
2917
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.