hide textbox if another contains a certain value #2

  • Thread starter Thread starter Kim
  • Start date Start date
K

Kim

First of all, I would like to thank Duane Hookum on my
last post "hide textbox if another contains a certain
value". That works great.

This next one is similar, But I'm having trouble with my
formula
I have 6 txtBoxes:

txtBoxes | represents txtBoxes | represents
---------|------------ ---------|------------
occRepMm | (month) returnMm | (month)
occRepDd | (day) returnDd | (day)
occRepYy | (year) returnYy | (year)

If the return Date is 2 days greater the the OccRep Date,
I would like an entirely different label and textbox to
appear.

I have a similar setup on my form (which works)
ex:

If (Me!returnMm.column(0) - Me!occMm >= 0) And (Me!
returnDd.Colum(0) - Me!occDd >= 2)
then
Me!blahblahblah.visible = True
else
Me!blahblahblah.visible = False
end if

I would like to know if I can have a similar effect on a
report.

many thanks in advance.
 
Kim said:
First of all, I would like to thank Duane Hookum on my
last post "hide textbox if another contains a certain
value". That works great.

This next one is similar, But I'm having trouble with my
formula
I have 6 txtBoxes:

txtBoxes | represents txtBoxes | represents
---------|------------ ---------|------------
occRepMm | (month) returnMm | (month)
occRepDd | (day) returnDd | (day)
occRepYy | (year) returnYy | (year)

If the return Date is 2 days greater the the OccRep Date,
I would like an entirely different label and textbox to
appear.

I have a similar setup on my form (which works)
ex:

If (Me!returnMm.column(0) - Me!occMm >= 0) And (Me!
returnDd.Colum(0) - Me!occDd >= 2)
then
Me!blahblahblah.visible = True
else
Me!blahblahblah.visible = False
end if

I would like to know if I can have a similar effect on a
report.


Sure you can. Of course you would not be using combo boxes,
but the idea is valid.
 
Any suggestions on how I would achieve this result?

the coding seems entirely different for a report than a
form.
 
Any suggestions on how I would achieve this result?

the coding seems entirely different for a report than a
form.

No, the coding for a report uses the same logic. You would
just be working with the report's text boxes instead of the
form's combo boxes. I can't provide any sugested code from
the information you've posted.

I suspect your question is not really about how to make
something invisible, it's probably more a question of how
you get the data into the report. Again, I can't tell what
you're doing so this is just guess work, but most likely
it's a matter of joining the combo box's table in the
report's record source table. At least, then you can
include the appropriate fields that you need to test.
--
Marsh
MVP [MS Access]



 
What i have is 3 txtBoxes pulled from one table:

occMm, occDd, occYy

and three pulled from another table:

returnMm, returnDd, returnYy

this is done through a query. All fields are Number
formatted in their tables. they are named the same as the
names of the fields (to keep things simple). My focus is
on the first two of each group (the 3rd is irrelevant)

I also have a label and a text box that I would like to be
visible if the equation is over 2 days, set to be a
reminder.

they are as follows:

lblHrdcRep, hrdcSub

On the report I have them set to visible = no

I've tried this code on the format event of the report:

If (Me.returnMm - Me.occRepMm >= 0) And (Me.returnDd -
Me.occRepDd >= 2) Then
Me.lblHrdcRep.Visible = True
Me.hrdcSub.Visible = True
End If

When I try to open the report I get a runtine error 13 /
type mismatch.
Therefore I believe I may be on the wrong path as far as
the code goes.
I would appreciate any suggestions.

thanx again, in advance.

-----Original Message-----
Any suggestions on how I would achieve this result?

the coding seems entirely different for a report than a
form.

No, the coding for a report uses the same logic. You would
just be working with the report's text boxes instead of the
form's combo boxes. I can't provide any sugested code from
the information you've posted.

I suspect your question is not really about how to make
something invisible, it's probably more a question of how
you get the data into the report. Again, I can't tell what
you're doing so this is just guess work, but most likely
it's a matter of joining the combo box's table in the
report's record source table. At least, then you can
include the appropriate fields that you need to test.
--
Marsh
MVP [MS Access]




.
 
That error, if its even in this section of code, would imply
that one or more of the fields are text type. The code you
posted should work fine as long as the fields are one of the
numeric types. If that's not it, then try to isolate where
the error is really coming from.

BTW, if the report's record source has more than one record,
you should also set the Visible property to False when it's
less than two days old.
 
Back
Top