Expression works in one part of report not another

  • Thread starter Thread starter Jonathan Stratford
  • Start date Start date
J

Jonathan Stratford

Hi,

This seemingly random problem has completely confused me!
I have a form which has a text box on, into which the
user enters a date. The reprot uses a query which uses
this date to chose which fields to return. this bit works
fine, and the date field on the form is called txtDate. I
assign this to an expression in the query, Expr1: [Forms]!
[FSearch]![txtDate], which is the same syntax as for two
other fields on the query which compare the date entered
to ensure it is between the date of leaving and the date
of return, to show the data. These two fields work, as it
only returns the correct data. However, on the report, i
want to be able to say "The leave allowed for " Expr1,
but for some reason in the query this value is blank.
Any suggestions would be very welcome!!!

Many thanks,

Jonathan Stratford
 
Hi,

This seemingly random problem has completely confused me!
I have a form which has a text box on, into which the
user enters a date. The reprot uses a query which uses
this date to chose which fields to return. this bit works
fine, and the date field on the form is called txtDate. I
assign this to an expression in the query, Expr1: [Forms]!
[FSearch]![txtDate], which is the same syntax as for two
other fields on the query which compare the date entered
to ensure it is between the date of leaving and the date
of return, to show the data. These two fields work, as it
only returns the correct data. However, on the report, i
want to be able to say "The leave allowed for " Expr1,
but for some reason in the query this value is blank.
Any suggestions would be very welcome!!!

Many thanks,

Jonathan Stratford

Add an unbound control to the report header.
Set it's control source to something like:
= The leave allowed for " & forms!FSearch!txtDate

The form must remain open while the report runs.

The usual method is to open the form in acDialog in the report's open
event.

DoCmd.OpenForm "FSearch", , , , , acDialog

The form is closed in the report's close event.
DoCmd.Close acForm, "FSearch"

Add a command button to the form to hide it when the report previews.
Code it's click event:
Me.Visible = False
 
Back
Top