G
Guest
HI!
I made a form that asks the user to choose from a list box a criterion. The
form then opens a report with a specific filter. In my report, I have an
unbound text box and I want its control source (a date field from a table) to
automatically change, depending of the filter. (I have more than one date
fields in my table, like DateStatic, DateDynamic, etc.). Formats are all in
short date.
I cant' get the code right for this. I got it right for text boxes bounded
to strings, but not for date.
Can someone please help me?
Thanks a lot
Louis Pat
----------
It's a database on hydrants of a city. Employees will work on a hydrant and
retrieve some data, like its static pressure, dynamic pressure... In my table
I have the different kinds of pressure and the date employees retrieve that
data.
Here is my report's code: (sorry, some names are in french, but I didn't
want to translate all my code) The format property of the unbound text bo is
set to short date too.
Private Sub Report_Open(Cancel As Integer)
Dim sTitle As String
Dim sUnits As String
Dim PressureType As String
Dim sDate As Date
Select Case Forms![bornes exception]!lecture
Case 1
'Title of the report
sTitle = "Bornes d'incendie qui drainent mal ou qui ne drainent
pas"
'Units of the pressure
sUnits = "lbs/ft²"
'Name of the field Pressure type
sPressureType = "[static pressure]"
'Name of the field Date : that's what is not working
sDate = " [date static] " & Format([date static], "short date")
Case 2
......... and so on
..........
End Select
Me.Title.Caption = sTitle
Me.Units.Caption = sUnits
Me.lecture.ControlSource = Pressure
Me.date1.ControlSource = sDate
End Sub
I made a form that asks the user to choose from a list box a criterion. The
form then opens a report with a specific filter. In my report, I have an
unbound text box and I want its control source (a date field from a table) to
automatically change, depending of the filter. (I have more than one date
fields in my table, like DateStatic, DateDynamic, etc.). Formats are all in
short date.
I cant' get the code right for this. I got it right for text boxes bounded
to strings, but not for date.
Can someone please help me?
Thanks a lot
Louis Pat
----------
It's a database on hydrants of a city. Employees will work on a hydrant and
retrieve some data, like its static pressure, dynamic pressure... In my table
I have the different kinds of pressure and the date employees retrieve that
data.
Here is my report's code: (sorry, some names are in french, but I didn't
want to translate all my code) The format property of the unbound text bo is
set to short date too.
Private Sub Report_Open(Cancel As Integer)
Dim sTitle As String
Dim sUnits As String
Dim PressureType As String
Dim sDate As Date
Select Case Forms![bornes exception]!lecture
Case 1
'Title of the report
sTitle = "Bornes d'incendie qui drainent mal ou qui ne drainent
pas"
'Units of the pressure
sUnits = "lbs/ft²"
'Name of the field Pressure type
sPressureType = "[static pressure]"
'Name of the field Date : that's what is not working
sDate = " [date static] " & Format([date static], "short date")
Case 2
......... and so on
..........
End Select
Me.Title.Caption = sTitle
Me.Units.Caption = sUnits
Me.lecture.ControlSource = Pressure
Me.date1.ControlSource = sDate
End Sub