parameter? textbox

H

hermie

Hello
I have an unbound form with a bound graphic in the detail section. In the
pageheader I created an unbound textbox for enter the month and year but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the textbox
is: [enter month and year]
Any help is welcome

Herman
 
G

Graham R Seach

Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle = trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
 
H

hermie

Hi Graham Thx for responding

Maybe I was not clear in my question I only want to add in the textbox or
label? the text like december 2004.
Nothing more
Itried your advice but not able to edit the txtbox OnEnter and OnExit
properties?

herman

Graham R Seach said:
Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle = trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

hermie said:
Hello
I have an unbound form with a bound graphic in the detail section. In the
pageheader I created an unbound textbox for enter the month and year but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the textbox
is: [enter month and year]
Any help is welcome

Herman
 
H

hermie

Hi Graham

I just realize i posted this wrong it is a report not a for form.
Herman
Graham R Seach said:
Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle = trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

hermie said:
Hello
I have an unbound form with a bound graphic in the detail section. In the
pageheader I created an unbound textbox for enter the month and year but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the textbox
is: [enter month and year]
Any help is welcome

Herman
 
H

hermie

Graham R Seach said:
Hermie,

A report?? Well that changes things a tad. ;-P

OK, if I understand you correctly, you want today's date to display in the
format "December 2004". If that's the case, then add the following to the
Textbox's ControlSource property:
=Format(Date(), "mmmm yyyy")

In your first post, however, you stated "The value of the textbox is: [enter
month and year]", which implies that you want to be able to enter a value in
the report. I'm afraid you can't do that. Reports are output only. If you
want to select a month/year, you'll have to do it either in the reports
unerlying query, or before the report is called, perhaps on the form (or in
the code) that calls it.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

hermie said:
Hi Graham

I just realize i posted this wrong it is a report not a for form.
Herman
Graham R Seach said:
Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre
the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to
content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle = trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Hello
I have an unbound form with a bound graphic in the detail section. In the
pageheader I created an unbound textbox for enter the month and year
but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the textbox
is: [enter month and year]
Any help is welcome

Herman
 
G

Graham R Seach

Hermie,

A report?? Well that changes things a tad. ;-P

OK, if I understand you correctly, you want today's date to display in the
format "December 2004". If that's the case, then add the following to the
Textbox's ControlSource property:
=Format(Date(), "mmmm yyyy")

In your first post, however, you stated "The value of the textbox is: [enter
month and year]", which implies that you want to be able to enter a value in
the report. I'm afraid you can't do that. Reports are output only. If you
want to select a month/year, you'll have to do it either in the reports
unerlying query, or before the report is called, perhaps on the form (or in
the code) that calls it.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

hermie said:
Hi Graham

I just realize i posted this wrong it is a report not a for form.
Herman
Graham R Seach said:
Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre
the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to
content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle = trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

hermie said:
Hello
I have an unbound form with a bound graphic in the detail section. In the
pageheader I created an unbound textbox for enter the month and year
but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the textbox
is: [enter month and year]
Any help is welcome

Herman
 
H

hermie

Graham

No I not want today's month and year I only want to enter the textbox with
text like: "diciembre de 2004" when I run the report.
Herman

Graham R Seach said:
Hermie,

A report?? Well that changes things a tad. ;-P

OK, if I understand you correctly, you want today's date to display in the
format "December 2004". If that's the case, then add the following to the
Textbox's ControlSource property:
=Format(Date(), "mmmm yyyy")

In your first post, however, you stated "The value of the textbox is: [enter
month and year]", which implies that you want to be able to enter a value in
the report. I'm afraid you can't do that. Reports are output only. If you
want to select a month/year, you'll have to do it either in the reports
unerlying query, or before the report is called, perhaps on the form (or in
the code) that calls it.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

hermie said:
Hi Graham

I just realize i posted this wrong it is a report not a for form.
Herman
Graham R Seach said:
Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre
the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to
content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle = trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Hello
I have an unbound form with a bound graphic in the detail section. In the
pageheader I created an unbound textbox for enter the month and year
but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the textbox
is: [enter month and year]
Any help is welcome

Herman
 
G

Graham R Seach

Hermie,

Let's see if I understand you correctly this time. You want the user to
manually type in the date?

If so, then assuming your Textbox is called "txtMonthYear", then add the
following code to the report's Activate event:

Me!txtMonthYear = InputBox("Enter month and year.", Format(Date(), "mmmm
yyyy"))

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


hermie said:
Graham

No I not want today's month and year I only want to enter the textbox with
text like: "diciembre de 2004" when I run the report.
Herman

Graham R Seach said:
Hermie,

A report?? Well that changes things a tad. ;-P

OK, if I understand you correctly, you want today's date to display in
the
format "December 2004". If that's the case, then add the following to the
Textbox's ControlSource property:
=Format(Date(), "mmmm yyyy")

In your first post, however, you stated "The value of the textbox is: [enter
month and year]", which implies that you want to be able to enter a value in
the report. I'm afraid you can't do that. Reports are output only. If you
want to select a month/year, you'll have to do it either in the reports
unerlying query, or before the report is called, perhaps on the form (or in
the code) that calls it.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

hermie said:
Hi Graham

I just realize i posted this wrong it is a report not a for form.
Herman
Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre
the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to
content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As
TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle =
trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Hello
I have an unbound form with a bound graphic in the detail section.
In
the
pageheader I created an unbound textbox for enter the month and year
but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the
textbox
is: [enter month and year]
Any help is welcome

Herman
 
H

hermie

Hi Graham

No you not understand me well, I want in the inputbox any text like in my
case december 2004, but can also be something like "Report of the month
december 2004". You showed the description of an inputbox, ( I saw the
definition in VBhelp) but when put I put > Me!txtmesano = InputBox(Enter
month and year,) it gives an error Microsoft cannot find the macro? I think
I have to put it the code window of the event procedure.

Hope I give you more information and remember it is a report not a form!
Herman
Graham R Seach said:
Hermie,

Let's see if I understand you correctly this time. You want the user to
manually type in the date?

If so, then assuming your Textbox is called "txtMonthYear", then add the
following code to the report's Activate event:

Me!txtMonthYear = InputBox("Enter month and year.", Format(Date(), "mmmm
yyyy"))

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


hermie said:
Graham

No I not want today's month and year I only want to enter the textbox with
text like: "diciembre de 2004" when I run the report.
Herman

Graham R Seach said:
Hermie,

A report?? Well that changes things a tad. ;-P

OK, if I understand you correctly, you want today's date to display in
the
format "December 2004". If that's the case, then add the following to the
Textbox's ControlSource property:
=Format(Date(), "mmmm yyyy")

In your first post, however, you stated "The value of the textbox is: [enter
month and year]", which implies that you want to be able to enter a
value
in
the report. I'm afraid you can't do that. Reports are output only. If you
want to select a month/year, you'll have to do it either in the reports
unerlying query, or before the report is called, perhaps on the form
(or
in
the code) that calls it.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Hi Graham

I just realize i posted this wrong it is a report not a for form.
Herman
Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre
the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to
content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As
TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle =
trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Hello
I have an unbound form with a bound graphic in the detail section.
In
the
pageheader I created an unbound textbox for enter the month and year
but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the
textbox
is: [enter month and year]
Any help is welcome

Herman
 
H

hermie

Hi Graham
I just created next event procedure
Private Sub Report_Activate()
Me!txtmesano = InputBox(["mes y ano"])
End Sub
But I think I missing something? The VB help helpfile shows MyValue? instead
of Me!txtnmesano.


Herman


Graham R Seach said:
Hermie,

Let's see if I understand you correctly this time. You want the user to
manually type in the date?

If so, then assuming your Textbox is called "txtMonthYear", then add the
following code to the report's Activate event:

Me!txtMonthYear = InputBox("Enter month and year.", Format(Date(), "mmmm
yyyy"))

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


hermie said:
Graham

No I not want today's month and year I only want to enter the textbox with
text like: "diciembre de 2004" when I run the report.
Herman

Graham R Seach said:
Hermie,

A report?? Well that changes things a tad. ;-P

OK, if I understand you correctly, you want today's date to display in
the
format "December 2004". If that's the case, then add the following to the
Textbox's ControlSource property:
=Format(Date(), "mmmm yyyy")

In your first post, however, you stated "The value of the textbox is: [enter
month and year]", which implies that you want to be able to enter a
value
in
the report. I'm afraid you can't do that. Reports are output only. If you
want to select a month/year, you'll have to do it either in the reports
unerlying query, or before the report is called, perhaps on the form
(or
in
the code) that calls it.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Hi Graham

I just realize i posted this wrong it is a report not a for form.
Herman
Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre
the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to
content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As
TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle =
trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Hello
I have an unbound form with a bound graphic in the detail section.
In
the
pageheader I created an unbound textbox for enter the month and year
but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the
textbox
is: [enter month and year]
Any help is welcome

Herman
 
H

hermie

Graham

I gave your suggestion a try and it works, first I thought I could only see
the month and year, but when I enter text in the inputbox like: Report of
the month december 2004 it works?
Many thanks for your help

Herman

Graham R Seach said:
Hermie,

Let's see if I understand you correctly this time. You want the user to
manually type in the date?

If so, then assuming your Textbox is called "txtMonthYear", then add the
following code to the report's Activate event:

Me!txtMonthYear = InputBox("Enter month and year.", Format(Date(), "mmmm
yyyy"))

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia

Microsoft Access 2003 VBA Programmer's Reference
http://www.wiley.com/WileyCDA/WileyTitle/productCd-0764559036.html


hermie said:
Graham

No I not want today's month and year I only want to enter the textbox with
text like: "diciembre de 2004" when I run the report.
Herman

Graham R Seach said:
Hermie,

A report?? Well that changes things a tad. ;-P

OK, if I understand you correctly, you want today's date to display in
the
format "December 2004". If that's the case, then add the following to the
Textbox's ControlSource property:
=Format(Date(), "mmmm yyyy")

In your first post, however, you stated "The value of the textbox is: [enter
month and year]", which implies that you want to be able to enter a
value
in
the report. I'm afraid you can't do that. Reports are output only. If you
want to select a month/year, you'll have to do it either in the reports
unerlying query, or before the report is called, perhaps on the form
(or
in
the code) that calls it.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Hi Graham

I just realize i posted this wrong it is a report not a for form.
Herman
Hermie,

No you can't do it that way. Try this:

1. If I assume your textbox is called "txtMonth", then...
2. Set the textbox's BackStyle property to Transparent.
3. Add a Label control to the form, size it exactly the same as the
textbox.
4. Set the Label's Caption property to "Enter the month", and centre
the
text.
5. Set the Label's BackColor to white.
6. Set the Label's ForeColor property to grey (12632256).
7. Set the Textbox's OnEnter property (the property, not the event
procedure) as follows:
=SetControlTransparency(1)
8. Set the Textbox's OnExit property (the property, not the event
procedure) as follows:
=SetControlTransparency(-1)
9. Place the Label exactly under the Textbox.
10. Add the following to a standard module:
Private Enum TransparencyEnum
trsNONE = -1 'Set the transparency according to
content
trsNORMAL = 1 'Set the BackStyle to Normal (not
transparent)
trsTRANSPARENT = 0 'Set the BackStyle to transparent
End Enum

Private Function SetControlTransparency(lStyle As
TransparencyEnum)
'Sets the specified control's BackStyle to Normal or
Transparent.

Select Case lStyle
Case trsNONE
'If the control has content, then make it opaque,
'otherwise make it transparent
If Len(Trim(Screen.ActiveControl)) = 0 Then
Screen.ActiveControl.BackStyle =
trsTRANSPARENT
Else
Screen.ActiveControl.BackStyle = trsNORMAL
End If
Case trsNORMAL
'Make the control opaque
Screen.ActiveControl.BackStyle = trsNORMAL
Case trsTRANSPARENT
'Make the control transparent
Screen.ActiveControl.BackStyle = trsTRANSPARENT
End Select
End Function

11. Repeats Steps 2 to 9, for txtYear. It will access the same code as
txtMonth.

Regards,
Graham R Seach
Microsoft Access MVP
Sydney, Australia
---------------------------

Hello
I have an unbound form with a bound graphic in the detail section.
In
the
pageheader I created an unbound textbox for enter the month and year
but
does work. It only shows the textbox as #name?
Is it not possible to do this in an unbound form? The value of the
textbox
is: [enter month and year]
Any help is welcome

Herman
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top