From: judith on 12 May 2010 08:48 how do i refer to a dynamic field name please. I have fields month1, month2, etc and only want to print the value for the current month Something like =val("[month" & [monthVal] & "]") Thanks
From: John Spencer on 12 May 2010 09:22 One method: Don't bind the control (txtShowCurrent) to anything (set its source to blank). In the section containing the control you should be able to use VBA to assign the value. Me.txtShowCurrent = Me.Controls("Month" & Month(Date()) This solution would require you to have 12 non-visible controls on your report in the relevant section bound to each of the 12 month fields. Another option might be to use the DLookup function to get the value you want from the report's record source. That depends on how your query is set up. DLookup("Month" & Month(Date()),"SomeQueryOrTable") This might require using the additional argument of DLookup to filter the result. John Spencer Access MVP 2002-2005, 2007-2010 The Hilltop Institute University of Maryland Baltimore County judith wrote: > how do i refer to a dynamic field name please. I have fields month1, month2, > etc and only want to print the value for the current month > Something like > > =val("[month" & [monthVal] & "]") > > Thanks > >
|
Pages: 1 Prev: Record count in report w/o records Next: Prevent users from accessing report design mode |