G
Guest
I am building an Employee database that will print a mailing label report
with labels showing the employee name and a line showing the "Week Ending"
date, which needs to be changed every week. I would like to have a box pop up
in which to enter the date, which would enter that date in every label. I am
having a problem setting this up.
I built the Mailing Label report with the name field from the query. I went
to design view, added a label control with "Week Ending:", and an unbound
text box next to it to hold the date value. I then wrote the following code
in a standard module:
Public Function EndingDate()
Dim StrInput as String, strMsg as String
strMsg = "Enter the date that this time card will end."
strInput = InputBox(strMsg, "Week Ending Date")
EndingDate = strInput
End Function
I set the Control Source property of the unbound text box equal to the
EndingDate function. I then set the OnOpen property of the report to the
EndingDate function so that, when the report opens, the Input Box would open
to accept the value for the date. This seems to be causing an endless loop,
because the Input Box won't close after the value is entered. The only way to
close it is by using Ctrl-Alt-Del which also closes the database. Is my
problem coming from setting the Control Source property of the text box to
the EndingDate function? If so, what should the Control Source be set to in
order to get the value from the EndingDate function? Or is there an easier
way to accomplish this task without using code? Thanks for your help.
with labels showing the employee name and a line showing the "Week Ending"
date, which needs to be changed every week. I would like to have a box pop up
in which to enter the date, which would enter that date in every label. I am
having a problem setting this up.
I built the Mailing Label report with the name field from the query. I went
to design view, added a label control with "Week Ending:", and an unbound
text box next to it to hold the date value. I then wrote the following code
in a standard module:
Public Function EndingDate()
Dim StrInput as String, strMsg as String
strMsg = "Enter the date that this time card will end."
strInput = InputBox(strMsg, "Week Ending Date")
EndingDate = strInput
End Function
I set the Control Source property of the unbound text box equal to the
EndingDate function. I then set the OnOpen property of the report to the
EndingDate function so that, when the report opens, the Input Box would open
to accept the value for the date. This seems to be causing an endless loop,
because the Input Box won't close after the value is entered. The only way to
close it is by using Ctrl-Alt-Del which also closes the database. Is my
problem coming from setting the Control Source property of the text box to
the EndingDate function? If so, what should the Control Source be set to in
order to get the value from the EndingDate function? Or is there an easier
way to accomplish this task without using code? Thanks for your help.