By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,504 Members | 1,212 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,504 IT Pros & Developers. It's quick & easy.

variables and control boxes

P: n/a
hey... i have a 12 or so page report where each page is quite different from
the others. the 20-50 controls i have on each page, however, are similar in
that they run on monthly and quarterly date intervals. what i'd like to do
is to be able to declare a text box or something somewhere to be equal to a
date range and then reference this text box in other controls. something
like this:

txtboxJANstart = dateserial(forms!formquarterly!txtboxyear, 1, 1)
txtboxJANend = dateserial (forms!formquarterly!txtboxyear, 1, 31)

except that while the control txtboxJANstart (formatted as \#mm/dd/yyyy\#)
DOES show #01/01/2005#, i can't use txtboxJANstart in any of the other
controls in the form. all i get is #Error. where can i convienently declare
these variables and call for them in controls in a report? btw, i have
formquarterly opened the whole time this report runs, so that's not the issue.
thanks.

--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200601/1
Jan 23 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

You shouldn't have the # marks showing in the Text Box, only the date.
The TextBox's Format should be "mm/dd/yyyy" (without the quotes, and
without the hash marks #).

Just set the ControlSource of txtboxJanStart to this:

=DateSerial(Forms!FormQuarterly!txtBoxYear, 1, 1)

BTW the Hungarian prefix for a TextBox is just txt. Your control would
be named

txtJanStart

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

-----BEGIN PGP SIGNATURE-----
Version: PGP for Personal Privacy 5.0
Charset: noconv

iQA/AwUBQ9VzoYechKqOuFEgEQJJnACgz1TAJ909aiSAn+JMGTlwC2 6Kl68AnRgJ
O5DM37BWwXpfonUoJU2QhHlh
=4cTw
-----END PGP SIGNATURE-----
ka******@comcast.net via AccessMonster.com wrote:
hey... i have a 12 or so page report where each page is quite different from
the others. the 20-50 controls i have on each page, however, are similar in
that they run on monthly and quarterly date intervals. what i'd like to do
is to be able to declare a text box or something somewhere to be equal to a
date range and then reference this text box in other controls. something
like this:

txtboxJANstart = dateserial(forms!formquarterly!txtboxyear, 1, 1)
txtboxJANend = dateserial (forms!formquarterly!txtboxyear, 1, 31)

except that while the control txtboxJANstart (formatted as \#mm/dd/yyyy\#)
DOES show #01/01/2005#, i can't use txtboxJANstart in any of the other
controls in the form. all i get is #Error. where can i convienently declare
these variables and call for them in controls in a report? btw, i have
formquarterly opened the whole time this report runs, so that's not the issue.
thanks.

Jan 24 '06 #2

P: n/a
the problem still lies in the fact that i can't seem to call on
txtboxJANstart at all from another control in the same report. what am i
still missing there?

MGFoster wrote:
You shouldn't have the # marks showing in the Text Box, only the date.
The TextBox's Format should be "mm/dd/yyyy" (without the quotes, and
without the hash marks #).

Just set the ControlSource of txtboxJanStart to this:

=DateSerial(Forms!FormQuarterly!txtBoxYear, 1, 1)

BTW the Hungarian prefix for a TextBox is just txt. Your control would
be named

txtJanStart
hey... i have a 12 or so page report where each page is quite different from
the others. the 20-50 controls i have on each page, however, are similar in

[quoted text clipped - 12 lines]
formquarterly opened the whole time this report runs, so that's not the issue.
thanks.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200601/1
Jan 24 '06 #3

P: n/a
The other control's ControlSource would look like this:

=txtboxJanStart

Is that how you've got it?
--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

ka******@comcast.net via AccessMonster.com wrote:
the problem still lies in the fact that i can't seem to call on
txtboxJANstart at all from another control in the same report. what am i
still missing there?

MGFoster wrote:
You shouldn't have the # marks showing in the Text Box, only the date.
The TextBox's Format should be "mm/dd/yyyy" (without the quotes, and
without the hash marks #).

Just set the ControlSource of txtboxJanStart to this:

=DateSerial(Forms!FormQuarterly!txtBoxYear, 1, 1)

BTW the Hungarian prefix for a TextBox is just txt. Your control would
be named

txtJanStart

hey... i have a 12 or so page report where each page is quite different from
the others. the 20-50 controls i have on each page, however, are similar in


[quoted text clipped - 12 lines]
formquarterly opened the whole time this report runs, so that's not the issue.
thanks.


Jan 24 '06 #4

P: n/a
actually, what i have is

=Abs(Sum([datesold] Between [txtboxJANstart] And [txtboxJANend]))

which does work when i type

=Abs(Sum([datesold] Between #1/1/2005# And #1/31/2005#))

the year is going to change as time goes by which is why i wanted it to be
this way. otherwise i'm going to have to do a complicated series of controls
to calculate all of this.

MGFoster wrote:
The other control's ControlSource would look like this:

=txtboxJanStart

Is that how you've got it?
the problem still lies in the fact that i can't seem to call on
txtboxJANstart at all from another control in the same report. what am i

[quoted text clipped - 20 lines]
formquarterly opened the whole time this report runs, so that's not the issue.
thanks.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200601/1
Jan 24 '06 #5

P: n/a
alternatively, why won't this work:

=abs(sum(datesold between # dateserial(txtboxyear, 1, 1) # and # dateserial
(txtboxyear, 1, 31) #))

or this

=abs(sum(datesold between # & dateserial(txtboxyear, 1, 1) & # and # &
dateserial(txtboxyear, 1, 31) & #))

it keeps telling me that i have an invalid date value

MGFoster wrote:
The other control's ControlSource would look like this:

=txtboxJanStart

Is that how you've got it?
the problem still lies in the fact that i can't seem to call on
txtboxJANstart at all from another control in the same report. what am i

[quoted text clipped - 20 lines]
formquarterly opened the whole time this report runs, so that's not the issue.
thanks.


--
Message posted via AccessMonster.com
http://www.accessmonster.com/Uwe/For...ccess/200601/1
Jan 24 '06 #6

P: n/a
Sometimes the TextBox isn't filled until "something" happens on the
report. You may try forcing the matter in the Report_Open event. Clear
the Control Source of the TextBoxes and in the Open event have something
like this:

Me!txtboxJanStart = Forms!FormName!ControlName

--
MGFoster:::mgf00 <at> earthlink <decimal-point> net
Oakland, CA (USA)

ka******@comcast.net via AccessMonster.com wrote:
actually, what i have is

=Abs(Sum([datesold] Between [txtboxJANstart] And [txtboxJANend]))

which does work when i type

=Abs(Sum([datesold] Between #1/1/2005# And #1/31/2005#))

the year is going to change as time goes by which is why i wanted it to be
this way. otherwise i'm going to have to do a complicated series of controls
to calculate all of this.

MGFoster wrote:
The other control's ControlSource would look like this:

=txtboxJanStart

Is that how you've got it?
the problem still lies in the fact that i can't seem to call on
txtboxJANstart at all from another control in the same report. what am i


[quoted text clipped - 20 lines]
>formquarterly opened the whole time this report runs, so that's not the issue.
>thanks.


Jan 24 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.