Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Changing values of table in OnFormat event

Status
Not open for further replies.

madctch

MIS
Jun 12, 2007
18
US
I have data that needs to be changed based on the date that the report is accessed, but I cannot figure out how to change the data in the OnFormat event. Ex.
Code:
If Now = #07/07/2007# Then [New]= -1 End If
 
Have you tried:

[New]= (Now = #07/07/2007#)

[New] will have to be an unbound control. It is best that it does not have the same name as a field.
 
[New] is a field in the table General Information. When I run the report I get runtime error telling me I cannot assign a value to the object.
 
In that case you will need to use a query or add an unbound textbox to the report:

[tt]If Date = #07/07/2007# Then
Me.txtNew = True
Else
Me.txtNew = [New]
End If[/tt]
 
I need to sort based on the value of the unbound control. How can I do that?
 
You need to do this in a query in that case. Built your query to include the change to the field and create you report from that.

NewNew: IIf(Date=#07/07/2007#,True,"New")
 
Thanks! I just created an action query and that did the trick.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top