Expression works in one part of report not another

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
 
F

fredg

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
 

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