473,757 Members | 2,284 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Trapping Click With Calculated Check Box

I have a check box on a form that's bound to a function that returns a
True/False value. When the user clicks on the check box, I run some code
through the MouseDown event. Everything works fine.

Only problem is: when the user clicks on it, there's a beep, and then they
get a status bar message: "Control can't be
edited; it's bound to the expression...." That's very annoying and
disconcerting.

Is there a way to trap the click and avoid the message? The Access online
help says that MouseDown can't be canceled. And OnClick and BeforeUpdate
don't seem to be called when it's a calculated control. Anyone have any
ideas on how to work around this?

I would put a command button on top of the check box; but the users need to
be able to work with it in Datasheet View, and command buttons don't appear
there.

Any ideas?

Thanks!

Neil
Nov 13 '05 #1
7 2453
Hi,
once you have a control with function in control source - you can't update
it. instead you can set a default value property to this function, and leave
control source blank (or bind to a updatable field)

command buttons does not appear on datasheet view, but you can use a
continuous form for this

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
"Neil" <no****@nospam. net> wrote in message
news:ML******** ********@newsre ad2.news.pas.ea rthlink.net...
I have a check box on a form that's bound to a function that returns a
True/False value. When the user clicks on the check box, I run some code
through the MouseDown event. Everything works fine.

Only problem is: when the user clicks on it, there's a beep, and then they
get a status bar message: "Control can't be
edited; it's bound to the expression...." That's very annoying and
disconcerting.

Is there a way to trap the click and avoid the message? The Access online
help says that MouseDown can't be canceled. And OnClick and BeforeUpdate
don't seem to be called when it's a calculated control. Anyone have any
ideas on how to work around this?

I would put a command button on top of the check box; but the users need
to be able to work with it in Datasheet View, and command buttons don't
appear there.

Any ideas?

Thanks!

Neil

Nov 13 '05 #2
Yes, I know you can't update a calculated control. What I wrote was that I
handle any updating through the MouseDown event. What I am trying to do is
trap the message that I noted in my original post so that the user does not
receive it.

And, yes, Continuous Forms would work, but the client insists on Datasheet
View (they like being able to hide and show columns, resize columns, and
change the order of columns).

Neil
"Alex Dybenko" <al*****@PLEASE .cemi.NO.rssi.S PAM.ru> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
Hi,
once you have a control with function in control source - you can't update
it. instead you can set a default value property to this function, and
leave control source blank (or bind to a updatable field)

command buttons does not appear on datasheet view, but you can use a
continuous form for this

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
"Neil" <no****@nospam. net> wrote in message
news:ML******** ********@newsre ad2.news.pas.ea rthlink.net...
I have a check box on a form that's bound to a function that returns a
True/False value. When the user clicks on the check box, I run some code
through the MouseDown event. Everything works fine.

Only problem is: when the user clicks on it, there's a beep, and then
they get a status bar message: "Control can't be
edited; it's bound to the expression...." That's very annoying and
disconcerting.

Is there a way to trap the click and avoid the message? The Access online
help says that MouseDown can't be canceled. And OnClick and BeforeUpdate
don't seem to be called when it's a calculated control. Anyone have any
ideas on how to work around this?

I would put a command button on top of the check box; but the users need
to be able to work with it in Datasheet View, and command buttons don't
appear there.

Any ideas?

Thanks!

Neil


Nov 13 '05 #3
What's the code that you're running, and what is it supposed to be doing?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Neil" <no****@nospam. net> wrote in message
news:ML******** ********@newsre ad2.news.pas.ea rthlink.net...
I have a check box on a form that's bound to a function that returns a
True/False value. When the user clicks on the check box, I run some code
through the MouseDown event. Everything works fine.

Only problem is: when the user clicks on it, there's a beep, and then they
get a status bar message: "Control can't be
edited; it's bound to the expression...." That's very annoying and
disconcerting.

Is there a way to trap the click and avoid the message? The Access online
help says that MouseDown can't be canceled. And OnClick and BeforeUpdate
don't seem to be called when it's a calculated control. Anyone have any
ideas on how to work around this?

I would put a command button on top of the check box; but the users need
to be able to work with it in Datasheet View, and command buttons don't
appear there.

Any ideas?

Thanks!

Neil

Nov 13 '05 #4
It basically adds an item to a collection to store the "checked" values, and
removes an item for "unchecked" values. The check box, itself, is bound to
the formula "=IsSelecte d([ID])" where IsSelected() returns True or False,
based on whether or not the item's in the collection.

Thus, when the user clicks on the check box, the MouseDown event is
triggered, which toggles whether or not the record is represented in the
collection. Unfortunately, it also triggers the message I noted, saying you
can't update the control. If I can just get rid of that message, it would be
fine.

Neil
"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:eK******** ******@TK2MSFTN GP09.phx.gbl...
What's the code that you're running, and what is it supposed to be doing?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Neil" <no****@nospam. net> wrote in message
news:ML******** ********@newsre ad2.news.pas.ea rthlink.net...
I have a check box on a form that's bound to a function that returns a
True/False value. When the user clicks on the check box, I run some code
through the MouseDown event. Everything works fine.

Only problem is: when the user clicks on it, there's a beep, and then
they get a status bar message: "Control can't be
edited; it's bound to the expression...." That's very annoying and
disconcerting.

Is there a way to trap the click and avoid the message? The Access online
help says that MouseDown can't be canceled. And OnClick and BeforeUpdate
don't seem to be called when it's a calculated control. Anyone have any
ideas on how to work around this?

I would put a command button on top of the check box; but the users need
to be able to work with it in Datasheet View, and command buttons don't
appear there.

Any ideas?

Thanks!

Neil


Nov 13 '05 #5
And what's the actual code you're using?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Neil" <no****@nospam. net> wrote in message
news:Qq******** ********@newsre ad2.news.pas.ea rthlink.net...
It basically adds an item to a collection to store the "checked" values,
and removes an item for "unchecked" values. The check box, itself, is
bound to the formula "=IsSelecte d([ID])" where IsSelected() returns True
or False, based on whether or not the item's in the collection.

Thus, when the user clicks on the check box, the MouseDown event is
triggered, which toggles whether or not the record is represented in the
collection. Unfortunately, it also triggers the message I noted, saying
you can't update the control. If I can just get rid of that message, it
would be fine.

Neil
"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:eK******** ******@TK2MSFTN GP09.phx.gbl...
What's the code that you're running, and what is it supposed to be doing?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Neil" <no****@nospam. net> wrote in message
news:ML******** ********@newsre ad2.news.pas.ea rthlink.net...
I have a check box on a form that's bound to a function that returns a
True/False value. When the user clicks on the check box, I run some code
through the MouseDown event. Everything works fine.

Only problem is: when the user clicks on it, there's a beep, and then
they get a status bar message: "Control can't be
edited; it's bound to the expression...." That's very annoying and
disconcerting.

Is there a way to trap the click and avoid the message? The Access
online help says that MouseDown can't be canceled. And OnClick and
BeforeUpdate don't seem to be called when it's a calculated control.
Anyone have any ideas on how to work around this?

I would put a command button on top of the check box; but the users need
to be able to work with it in Datasheet View, and command buttons don't
appear there.

Any ideas?

Thanks!

Neil



Nov 13 '05 #6
i am not sure, but i think MouseDown event also cause checkbox update, that
is why you get error message

as for datasheet with buttons - you can do this in Access. but you can try
to use some activex control, for example with janus grid you can do this:
www.janusys.com

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
"Neil" <no****@nospam. net> wrote in message
news:oX******** ********@newsre ad3.news.pas.ea rthlink.net...
Yes, I know you can't update a calculated control. What I wrote was that I
handle any updating through the MouseDown event. What I am trying to do is
trap the message that I noted in my original post so that the user does
not receive it.

And, yes, Continuous Forms would work, but the client insists on Datasheet
View (they like being able to hide and show columns, resize columns, and
change the order of columns).

Neil
"Alex Dybenko" <al*****@PLEASE .cemi.NO.rssi.S PAM.ru> wrote in message
news:%2******** **********@TK2M SFTNGP12.phx.gb l...
Hi,
once you have a control with function in control source - you can't
update it. instead you can set a default value property to this function,
and leave control source blank (or bind to a updatable field)

command buttons does not appear on datasheet view, but you can use a
continuous form for this

--
Alex Dybenko (MVP)
http://alexdyb.blogspot.com
http://www.PointLtd.com
"Neil" <no****@nospam. net> wrote in message
news:ML******** ********@newsre ad2.news.pas.ea rthlink.net...
I have a check box on a form that's bound to a function that returns a
True/False value. When the user clicks on the check box, I run some code
through the MouseDown event. Everything works fine.

Only problem is: when the user clicks on it, there's a beep, and then
they get a status bar message: "Control can't be
edited; it's bound to the expression...." That's very annoying and
disconcerting.

Is there a way to trap the click and avoid the message? The Access
online help says that MouseDown can't be canceled. And OnClick and
BeforeUpdate don't seem to be called when it's a calculated control.
Anyone have any ideas on how to work around this?

I would put a command button on top of the check box; but the users need
to be able to work with it in Datasheet View, and command buttons don't
appear there.

Any ideas?

Thanks!

Neil



Nov 13 '05 #7
Below is the code I'm using. It's adapted from Albert Kallal's multi-select
example, except that his uses a command button on top of the check box
(which avoids the problem I'm having, but doesn't work in Datasheet View).
The check box is bound to "=IsChecked ([Index])", where Index is the PK of
the record.

Neil

Dim colSelect As New Collection

Private Sub ExportSel_Mouse Down(Button As Integer, Shift As Integer, X As
Single, Y As Single)

ExportSelCheck

End Sub

Private Sub ExportSel_KeyDo wn(KeyCode As Integer, Shift As Integer)

If KeyCode = vbKeySpace Then
KeyCode = 0
ExportSelCheck
End If

End Sub

Private Sub ExportSelCheck( )

DoCmd.Echo False

If Not IsChecked(Me!In dex) Then
colSelect.Add CLng(Me!Index), CStr(Me!Index)
Else
colSelect.Remov e (CStr(Me!Index) )
End If

Me.ExportSel.Re query

DoCmd.Echo True

End Sub

Public Function IsChecked(vID As Variant) As Boolean

Dim lngID As Long

If Not IsMember(vID) Then Exit Function

lngID = colSelect(CStr( vID))
If lngID <> 0 Then
IsChecked = True
End If

End Function

Private Function IsMember(vID) As Boolean

Dim var As Variant

For Each var In colSelect
If var = vID Then
IsMember = True
Exit For
End If
Next

End Function
"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:ue******** ******@TK2MSFTN GP09.phx.gbl...
And what's the actual code you're using?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Neil" <no****@nospam. net> wrote in message
news:Qq******** ********@newsre ad2.news.pas.ea rthlink.net...
It basically adds an item to a collection to store the "checked" values,
and removes an item for "unchecked" values. The check box, itself, is
bound to the formula "=IsSelecte d([ID])" where IsSelected() returns True
or False, based on whether or not the item's in the collection.

Thus, when the user clicks on the check box, the MouseDown event is
triggered, which toggles whether or not the record is represented in the
collection. Unfortunately, it also triggers the message I noted, saying
you can't update the control. If I can just get rid of that message, it
would be fine.

Neil
"Douglas J. Steele" <NOSPAM_djsteel e@NOSPAM_canada .com> wrote in message
news:eK******** ******@TK2MSFTN GP09.phx.gbl...
What's the code that you're running, and what is it supposed to be
doing?

--
Doug Steele, Microsoft Access MVP
http://I.Am/DougSteele
(no e-mails, please!)

"Neil" <no****@nospam. net> wrote in message
news:ML******** ********@newsre ad2.news.pas.ea rthlink.net...
I have a check box on a form that's bound to a function that returns a
True/False value. When the user clicks on the check box, I run some code
through the MouseDown event. Everything works fine.

Only problem is: when the user clicks on it, there's a beep, and then
they get a status bar message: "Control can't be
edited; it's bound to the expression...." That's very annoying and
disconcerting.

Is there a way to trap the click and avoid the message? The Access
online help says that MouseDown can't be canceled. And OnClick and
BeforeUpdate don't seem to be called when it's a calculated control.
Anyone have any ideas on how to work around this?

I would put a command button on top of the check box; but the users
need to be able to work with it in Datasheet View, and command buttons
don't appear there.

Any ideas?

Thanks!

Neil



Nov 13 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2955
by: Wugi | last post by:
I'm trying to find an equivalent of key-event trapping which is easy in QBasic. Several of my programs build up a geometric figure with two parameter line families, eg with two nested for..next loops; after that, the process is redone, or moves on to a new position of the same figure. With a slow system each build-up may take some time. But after, say the inner for...next loop it's easy to scan for a key-event with an a$=inkey$ command...
3
4620
by: Paul | last post by:
I have an Access 2000 database with a form that is giving me some major headaches. When you open the form, it displays all records and allows editing, but has AllowAdditions set to False so that the user has to use my New Record button. When you click the New Record button, the form presents a new record for editing. My client wants to use the Escape key to cancel changes to new or existing records. On existing records, Access already...
6
4752
by: Peter Frost | last post by:
Please help I don't know if this is possible but what I would really like to do is to use On Error Goto to capture the code that is being executed when an error occurs. Any help would be much appreciated. Thanks in advance
4
9449
by: Keith | last post by:
I have the following code in the On No Data event of a report: **** On Error GoTo err_trap MsgBox "No items matching criteria.", vbInformation, gcApplication Cancel = True err_trap: If Err.Number = 2501 Then Exit Sub
13
4485
by: Thelma Lubkin | last post by:
I use code extensively; I probably overuse it. But I've been using error trapping very sparingly, and now I've been trapped by that. A form that works for me on the system I'm using, apparently runs into problems on the system where it will actually be used, and since I used so little error-trapping it dies very ungracefully. I will of course try to fix whatever is causing the error and add error-trapping to the functions where the...
5
2128
by: Jeff Ptak | last post by:
Can anyone tell me how to trap mouse click events in the Image control? I am trying to implement an image zoom feature using JavaScript where the user could "draw" a zoom box (aka rubber band box) on the image and the image would zoom to the extents of the box. Anyone know how to accomplish this?
40
2184
by: Allan M. Bruce | last post by:
I am applying for my first jobs after completing my PhD. I have been asked by a company to go and take a C programming test to see how my C skills are. Apparantly this test is mostly finding errors in small snippets of code but I was wondering if anyone could give me tips on what kind of things I should be looking out for. The one area I dont feel confident in is how to declare arrays of pointers and initialising multi-dimensional arrays....
5
5887
by: Henrik | last post by:
The problem is (using MS Access 2003) I am unable to retrieve long strings (255 chars) from calculated fields through a recordset. The data takes the trip in three phases: 1. A custom public function returns a long string. This works. 2. A query has a calculated field based on the custom function above. This works when the query is run directly.
19
3226
by: zacks | last post by:
I have a .NET 2.0 MDI application where the child form has a Tab Control. Each of the Tab in the Tab Control has a Validating event to handle what it should do when the user changes tabs. But these Validating Events are also fired when either the child form or the main (parent) form Close icon is clicked. And I need for these events to know if they are being invoked because the app (or child window) is being closed. I have set a boolean...
0
9487
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10069
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...
1
9884
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9735
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
8736
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
7285
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
6556
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
3828
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
2697
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.