Hello everyone,
I'm building a database that tracks large amounts of information per employee. The current piece I am working on is a calendar.
At this moment, I am trying to figure out the proper code just to have it auto-populate each unbound text box with the proper date (and then have buttons to go from month to month, and possible year to year). That is my primary concern.
I attempted the code and design from this site ( http://www.tek-tips.com/faqs.cfm?fid=838 ), and imputed it exactly as follows:
Code:
Private Sub form_open(cancel As Integer)
Me![FirstDate] = Date
Call filldates
End Sub
Private Function filldates()
Dim curday As Variant, curbox As Integer
curday = DateSerial(Year(Me![FirstDate]), Month(Me![FirstDate]), 1)
curday = DateAdd("d", 1 - Weekday(curday), curday)
For curbox = 0 To 41
Me("D" & curbox) = Day(curday)
Me("D" & curbox).Visible = False
If Month(curday) = Month(Me!FirstDate) Then Me("D" & curbox).Visible = True
curday = curday + 1
Next curbox
End Function
This is the error that I have received (and no matter that I try, I can not fix it):
Run Time Error: '2448': You can't assign a value to this object.
I have also received errors stating that it can't find "FirstDate", but I currently can not duplicate that error.
When I click Debug (for both the error I have quoted, and my previous error), it is the second line of code that is highlighted, as follows:
I have tried a few things to try to fix it, including changing different exclamation marks to periods, and I have also replaced "Date" (in the line quoted above) to "Date()". But when I go back into the code, the parenthesis have disappeared.
Lastly, some additional information so you know is what I plan to do with this calender:
I intend to have the each date on the calender a field in which I can input data, and have it create it's own table. In addition, in my primary table I have dates of previous events as related to each specific employee, then when the next event will be (or has to be) by, which is 6 months out. I plan on having these dates marked automatically on the calender with the Employees name, then have that name link to linked to their Personal Record (a form labeled 'PQR').
This is my first time posting so hopefully this information is all comprehensible!
I look forward to your responses and if you have any questions please ask!