Hey everyone. On one of my forms, I have it show several dates (each date during the week) based on a field where the user inputs a date. Bascially, I have a field called WeekEnding, and based on what goes in there, it puts a date in seven other fields: D1Date, D2Date, D3Date, D4Date, D5Date, D6Date, and D7Date.
On the Table where they live, I have set them all to the Date/Time type. For WeekEnding, I am using the predetermined date format: m/d/yyyy. For the others, I don't need to see the year, so I have made a custom format in the Table Design View: m/d
In D1Date, the custom format shows up correctly on my Form. However, on the others, it does not. It continues to show the year as well. The very weird thing is, in the Table itself, the date listed in those fields do NOT have the year on them, so inside the table itself, the format is correct. Anyone have any idea why this would be happening?
Here is the code I'm using to input the dates into the fields, and below that are a couple of screenshots.
Code:
Private Sub WeekEnding_AfterUpdate()
Me.D1Date = DateAdd("d", -6, Me.WeekEnding)
Me.D2Date = DateAdd("d", -5, Me.WeekEnding)
Me.D3Date = DateAdd("d", -4, Me.WeekEnding)
Me.D4Date = DateAdd("d", -3, Me.WeekEnding)
Me.D5Date = DateAdd("d", -2, Me.WeekEnding)
Me.D6Date = DateAdd("d", -1, Me.WeekEnding)
Me.D7Date = Me.WeekEnding
End Sub
Here's the table. You can see the dates inside D2Date are in the format that I want. The same is true for all the other dates: D1Date, D3Date, etc.
Here's the Form. You can see D1Date has the correct format (no year at the end), but the others are not correct; they are still displaying the year. That's why the #### are inside those boxes, because they don't fit with the additional characters. (D2Date is the one directly under the one that has "10/29" inside. D3Date is directly under that one, and so on.)
I can't figure this one out. Please let me know if you have any ideas.