Hi Martin,
I did this, and they all were True.
However, it seems that I've found the problem. I don't have a clue yet why
it works like this, but it does.
The user checks the corresponding checkboxes on the form. If he checks the
box, then unchecks it, everything works as it should - the value is False.
If, however, this checkbox was never touched (i.e. it looks grey) - tha
value is True.
I need to check an underlying table. My guess is that unless I initialize
the checkbox on the form, it inserts probably the Null value into the
table,
which is probably producing the value True on the report.
I don't see another explanation, but I probably should check the table
first.
Thank you very much for your help!
Peter
Martin J said:
Put a watch(right click-add watch) in for me.chk1 when i do it it usaully is
a=me![chk1]. There you can see the values. Make sure the watch screen is
showing.
HTH
Martin J
Peter Afonin said:
Martin,
All I do - I put this code in the reports Detail_Format event, put a
breakpoint then look at all values by pressing F11.
While all textbox values are correct, the checkbox values are always True.
Private Sub Detail_Format(Cancel As Integer, FormatCount As Integer)
On Error GoTo errHandler
Dim b As Boolean
Dim a As Boolean
Dim s As String
b = Me.chk1
a = Me.ckh2
s = Me.txtTest
GetOut:
Exit Sub
errHandler:
MsgBox "Error No.:" & CStr(Err.NUMBER) & vbCrLf & Err.Description & vbCrLf
& Err.Source, vbCritical
Resume GetOut
End Sub
Thank you,
Peter
So from what line of code to what line of code are you losing the value?
Are
you calling a function and passing the values? if so does the
function
still
have the correct value? Are you trying to change some checkbox values in a
function? if so you have to pass not by value but by address. If you could
post the code or whatever that is giving you the problem it would be
a lot
easier to diagnose.
HTH
Martin J
:
Thank you,
Yes, I'm sure. The code is very simple, like if I have a checkboxes chk1
and
chk2, I'm just declaring couple of boolean variables
Dim a as Boolean
Dim b as Boolean
a=Me.chk1
b=Me.chk2
put a breakpoint there, open the report and watch all values of these
checkboxes.
The same way I was checking the textboxes, and they always were showing
all
values correctly.
Thanks,
Peter
What is the line of code your using? Are you sure you are not
just
checking
the first record?
HTH
Martin J
:
Hello,
I'm using an Access project. In the report I have many checkboxes
populated
from the database. Some of them checked, some not. Everything looks
right.
However, when I try to get checkboxes values in code - I always get
True, no
matter whether this checkbox is checked or not. Why is this?
How can
I
get
the correct values? I don't have this problem with any other
control,
only
checkboxes.
I would appreciate your help.
Thank you,