If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
string field name
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 |
#2
|
|||
|
|||
string field name
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 |
Thread Tools | |
Display Modes | |
|
|