Link to home
Start Free TrialLog in
Avatar of Louverril
Louverril

asked on

Access 2010 runtime won't accept =Format (mydate,"mmm") on control source of form field.

I have field on a continuous subform whose control source (form recordsource is a query) is:

=Format([DTDC_Date],"mmm")

So it takes the field DTDC_Date from the query and displays just the month.

This works fine in the full version of Access but I get a Name? error in runtime.

I really need the user just to see the month (even when they click on the field) - that's why I am using Format.

Any ideas how I an get this to work?

By the way I am using the international date format.

Thanks Lou
ASKER CERTIFIED SOLUTION
Avatar of Dale Fye
Dale Fye
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Louverril
Louverril

ASKER

Argenti

The references from the accdb version should be copied when I rename it accdr (after making it accde)?

Thanks Lou
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Sorry  the question about references above was for Fyed - apologies :-).

Lou
Sounds like a missing reference issue to me.  When there are missing reference issues the built in VBA code like Format() will work.

Are you doing any Office (Word/Excel/Outlook/PowerPoint/etc) Automation? Do you have references set to any of the Office Apps?

Have you considered using Late Binding?

What other Office apps are installed on the target PC with  the Access Runtime?

Also see: Access Reference Problems
Jeff

I was doing that originally like this:
 Format([DTDC_DAte],"mmm") AS Monthme

but the subform would not even load. When I used a button instead to set the recordsource I actually got an error about using the format function.


Here is the full sql:
SELECT tblDowntimeCode.DTDC_ID, tblDowntimeCode.DTDC_Date, Year([DTDC_Date]) AS [Year], Format([DTDC_DAte],"mmm") AS Monthme, Month([DTDC_Date]) AS Expr1, tblDowntimeCode.DTDC_Code, tblDowntime_Codes.Code_Name, tblDowntimeCode.DTDC_JobsNo, tblDowntimeCode.DTDC_Comments, tblConfiguration_General.Config_SiteName, tblDowntimeCode.DTDC_Void
FROM tblDowntime_Codes INNER JOIN (tblConfiguration_General INNER JOIN tblDowntimeCode ON tblConfiguration_General.Config_ID = tblDowntimeCode.DTDC_Site) ON tblDowntime_Codes.Code_ID = tblDowntimeCode.DTDC_Code
ORDER BY Year([DTDC_Date]) DESC , Month([DTDC_Date]) DESC;


The form will not load.

I create another form (a single for this time)  with only three fields from the table on with the sql below and that won't load in runtime either:

SELECT tblDowntimeCode.DTDC_ID, tblDowntimeCode.DTDC_Code, Format([DTDC_Date],"mmm") AS Expr1
FROM tblDowntimeCode;


Thanks Lou
I've not had the need to work with in a Runtime environment.  I would assume that the accdr file will contain the pointers to the references, which should be installed on the users computers when the runtime version of Access is installed.  However, if the users computers are running a different operating system that may be an issue.
Argenti

Thanks for your idea the monthname gives me the month in the right form (mmm) but I really also wanted the user to be able to right click and use the default Filtermso - formatting the field like that won't let me. I appreciate the combo box idea but I also wanted them to be able to right click.

many thanks,

Lou
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Thanks to you all for your help.

In the end for now I used the monthname function in the query (rather than on the form) and this DID let me right click and filter - so I got what I wanted.

However I need to review the information in detail that HiTechCode has supplied about references.

I have removed the reference to Microsoft graph, I had added it in earlier when I was learning more about charts. The system I am writing does use a lot of charts.

 However I did see a posting by HiTechCoach (I believe) on another site warning someone to use the inbuilt Access chart tool from the design tab in Access to avoid problems with references - so I did! I have removed the reference and everything compiles and works fine without it.

Many thanks!

Lou
Just for completeness:

Removing the Graph reference still meant the Format command would not work. I haven't got the time today but I will create a completely fresh simple database and see if it works. I think it will - because I MUST have used it before and most a=of my systems run using runtime.


Thanks again,

Lou