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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Choosing a field depending on the date 1

Status
Not open for further replies.

etcski

Technical User
Oct 31, 2001
2
US
I am trying to choose a particular field depending on the date. I have
JAN_field1
FEB_field2
MAR_field3....etc.

In a report I am trying to reference today's date to automatically choose the correct field in the months_tbl to perform an autosum.

So if today's date is 14 FEB, The autosum will pick the FEB_field2 field from the months_tbl and SUM.
Thanks,
Ski
 
I haven't tried it but this might work.

Dim myName as string
myName = Format(Date(),"mmm")
DoCmd.GoToControl Like *myName*"


Paul
 
I tried it and it didn't work. This did in the AfterUpdate event for a textbox.

Dim myVal As String
myVal = Format(Date, "mmm")
Dim ctl As Control
For Each ctl In Me.Controls
If Left(ctl.Name, 3) = myVal Then
DoCmd.GoToControl ctl.Name
End If
Next

Paul
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top