Full Version: Check Box
UtterAccess Discussion Forums > Microsoft® Access > Access Forms
TheCaptain
Hello UA Members,

On my form i have multiple text boxes and ONE Check box. What i would like to do make the check box true or false based on criteria from two of the text boxes.

For example:

txt1 = date
txt2 = date

if txt1 has date entered but NO date in txt2 i want the check box to equal true.
if txt1 has date entered but txt2 date is also entered then check box equals false.

any ideas?

thanks in advance

TheCaptain
doran_doran
if not isnull(me.txt1) and isnull(me.txt2) then
me.checkbox=1
elseif not isnull(me.txt1) and not isnull(me.txt2) then
me.checkbox=0
end if

You can also you case and select method. I used to used if a lot and now I am shifting toward case and select. It makes me look more pro. LOL
niesz
You can also use a bit of Boolean logic...

Me.YourCheckBox = (IsDate(Me.Txt1) And Not IsDate(Me.Txt2))
TheCaptain
Doran Doran,

Thanks, i got it to work. i was using the null statement wrong in VBA, thanks for setting me straight....lol

i see you're from Houston. I lived there for 5 years on the westwide (Richmond and beltway) i'm moving back there in a few years. I love that city. Take care!!

thanks again.

TheCaptain
TheCaptain
Walter,

Thanks for the tip.

TheCaptain
niesz
NP.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.