J
Jorgen
Hi!
Thanks for all help up to this point!
I am still struggeling with having a form where one can specify to years in
a combo box, to get all entries which are in between. I have tried to sort by
date (given by a date() function) which works fine. But the field (year it
goes into production)i want to sort by, through to drop down boxes doesn't
work.
I have been wondering if it is because the field is defined as a text field,
but it should be possible to overcome!!
I have included the code under neath, so if someone wants to take a look, i
would be greatful! (Have gotten some good repiles from Allan Browne!!)
Private Sub Command4_Click()
Dim strreport As String
Dim strfield As String
Dim strwhere As String
Const conDateFormat = "#/yyyy\#"
strreport = "datesortreport"
strfield = "[main table].[Expected onstream year]"
If IsNull(Me.fromyear) Then
If Not IsNull(Me.toyear) Then
strwhere = strfield & " <= " & Format(Me.fromyear, conDateFormat)
End If
Else
If IsNull(Me.toyear) Then
strwhere = strfield & " >= " & Format(Me.toyear, conDateFormat)
Else
strwhere = strfield & " Between " & Format(Me.fromyear, conDateFormat) _
& " And " & Format(Me.toyear, conDateFormat)
End If
End If
DoCmd.OpenReport strreport, acViewPreview
End Sub
Thanks for all help up to this point!
I am still struggeling with having a form where one can specify to years in
a combo box, to get all entries which are in between. I have tried to sort by
date (given by a date() function) which works fine. But the field (year it
goes into production)i want to sort by, through to drop down boxes doesn't
work.
I have been wondering if it is because the field is defined as a text field,
but it should be possible to overcome!!
I have included the code under neath, so if someone wants to take a look, i
would be greatful! (Have gotten some good repiles from Allan Browne!!)
Private Sub Command4_Click()
Dim strreport As String
Dim strfield As String
Dim strwhere As String
Const conDateFormat = "#/yyyy\#"
strreport = "datesortreport"
strfield = "[main table].[Expected onstream year]"
If IsNull(Me.fromyear) Then
If Not IsNull(Me.toyear) Then
strwhere = strfield & " <= " & Format(Me.fromyear, conDateFormat)
End If
Else
If IsNull(Me.toyear) Then
strwhere = strfield & " >= " & Format(Me.toyear, conDateFormat)
Else
strwhere = strfield & " Between " & Format(Me.fromyear, conDateFormat) _
& " And " & Format(Me.toyear, conDateFormat)
End If
End If
DoCmd.OpenReport strreport, acViewPreview
End Sub