I finished writing a simple access database about 3 months ago but have come back to it to add extra functionality. However, some queries that I thought were working 3 months ago aren't working now. Here are some exmaples:
1. The following expression in a query gives a data type mismatch...
MonthName: MonthName(DatePart("m",[tblVisits]![VisitDate],2))
tblVisits!VisitDate has Date/Time data type. Also, if I remove the MonthName function, the DatePart function works on its own to give an integer month (e.g. 7 for July).
2. This expression also gives a data type mismatch...
WeekBeginning: DateAdd("d",-(Weekday([VisitDate])-2),[Visitdate])
VisitDate is the same field as in the previous example.
3. This is the one I really don't understand...
This query
Looks like this in datasheet view
But when I do a really simple edit (e.g. delete the M in MonthName and then retype it so it still says MonthName) then the datasheet view changes to this
The fact that the VisitDate field is involved in all of these exmaples makes me think that that's what's causing the problem; but I can't work out what. Any suggestions would be gratefully received!
Thanks.
1. The following expression in a query gives a data type mismatch...
MonthName: MonthName(DatePart("m",[tblVisits]![VisitDate],2))
tblVisits!VisitDate has Date/Time data type. Also, if I remove the MonthName function, the DatePart function works on its own to give an integer month (e.g. 7 for July).
2. This expression also gives a data type mismatch...
WeekBeginning: DateAdd("d",-(Weekday([VisitDate])-2),[Visitdate])
VisitDate is the same field as in the previous example.
3. This is the one I really don't understand...
This query
Looks like this in datasheet view
But when I do a really simple edit (e.g. delete the M in MonthName and then retype it so it still says MonthName) then the datasheet view changes to this
The fact that the VisitDate field is involved in all of these exmaples makes me think that that's what's causing the problem; but I can't work out what. Any suggestions would be gratefully received!
Thanks.