Update ACCESS 2010 table field based on value in another field with VBA
I have a table with a field DealDateContract. There are two additional fields in the table that need to be updated with information based on the date in this field, but I can't get the below to work. Am not sure if there is a QUATER function in ACCESS 2010.
Public Sub YearQuarterSort()
'UPdates quarter and quarter sort columns in tblReportSource table
Dim rst As DAO.Recordset
Set rst = CurrentDb.OpenRecordset("tblReportSource")
With rst
rst.MoveFirst
Do While Not rst.EOF
Storing values that can be easily calculated in a query is poor practice not to mention violating first normal form and the second one isn't even useful since you should be sorting by the date field itself.
Sandra Smith
ASKER
Thank you. This is better than what I inherited. And Yes, Pat, you are correct, but I am dealing with a legacy system and trying to do as much as I can without having to re-write the entire thing, which I do not have time to do. I mostly am trying to get this thing to work for a six-month life cycle. Where I can, I normalize, but sometimes the source process is so convoluted I just have to go with it!
One final comment and actually this I going to be another question on suggestions how to resolve, but rather than creating a partner table with partner names, this previous programmer put three-letter acronyms in column headers so now have to figure out how to report on partner data dynamically determining which columns to use as well as the types are not consistent so I cannot even parse out the client name and then column information. Now the client wants to add two more partners so now I need to add columns rather than simply add their names to a partner list with associated types of business processes.
DatePart("q", .DealDateContract)
/gustav