I am using it for regression testing of software. By transposing tables (horizontal to vertical), you can easily compare field by field for differences in data.
The datepart function will not understand a date that shows month only. You will need to add a space and a 1 to the string to run the function. Again, assuming the field is called txtdate, use the following:
datepart("m",datevalue([txtdate] & " 1"))
I believe that you will need to put a "rst.movefirst" line in before you start your loop. The recordset is starting out at BOF=true, so you are not on a record yet. Make sure that you test for an empty recordset before moving to any record or it will throw an error if that occurs.
Excel Problem
You can link to an Excel spreadsheet. Once the spreadsheet is linked, you can use it in a query just like a table. The only thing is that the name of the spreadsheet can not change. The link will only work if the full path and name of the spreadsheet are the same. You can...
I looked high and low for this. It can be done by import/export in Excel, but this works very well. (Code is from the Microsoft Knowledge Base).
Function Transposer(strSource As String, strTarget As String)
Dim db As DAO.Database
Dim tdfNewDef As DAO.TableDef
Dim fldNewField As...
Here are 2 very common reasons for "not updatable" recordsets.
1. Missing primary keys: Make sure all of your tables have a primary key. Use an autonum if you must, but you are better of using a unique field or concatenated unique fields.
2. Grouping (Totals) queries: If you are using a...
Keep in mind that a using "Format" does not change the underlying data. If the date that you are formatting is a long date, you would get some ugly results if you grouped by it in a query. Both methods will work depending on your needs.