Page 2 of 2 FirstFirst 12
Results 16 to 19 of 19
  1. #16
    Micron is offline Virtually Inert Person
    Windows 10 Access 2016
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,800
    If you're not going to use these dates in calculations and they're just for inserting into some document/letter and you actually need the table, then why not just make the table fields text? If you are calculating (e.g. deriving next date from another date by adding x days) the query can have date data type fields from the table as well as formatted fields for use in the letter. However, I don't mean to say that you would be storing the calculations, because generally speaking, you should not.



    OK, I see you posted while I was composing. You letter producing code could simply use format function within the string concatenation rather than altering table values:

    "The last time we were in contact was in " & Format([CalDate],"mmmm") & " of " & Format([CalDate],"yyyy") & "."

  2. #17
    JoeM is offline VIP
    Windows 7 32bit Access 2007
    Join Date
    Jun 2012
    Posts
    3,904
    Looks like we are pretty much right back where we started.
    You should be able to use my original suggestion to return it to say what you want, and it can all be done via Query calculations (no need to store it at the Table level).

    This is precisely the kind of thing that you use Queries for. In addition to selecting records, you can do calculations (including ones with text), that you want to show on your final output (whether that be a Report, Form, export, or merged with some document).

  3. #18
    Chuck is offline Advanced Beginner
    Windows 10 Access 2003
    Join Date
    Jul 2019
    Posts
    49
    Quote Originally Posted by JoeM View Post
    OK, I missed the fact that you are trying to use this value to update another field. As Micron said, the FORMAT function returns a text value, not a date value. So if "LastCallMonth" is a date field, yes, you will get a type conversion error, as your are trying to apply a text value to a date field.

    However, this all seems totally unnecessary. It sounds like that you just want to set "LastCallMonth" to be the same value as "CallDate". What is the point of copying over the value from one field to a table to another field in the same record? Also note that every valid date must have a month, day, and year. It sounds like all you really want is to display that date in a different format. You can easily change the format of any date field you want to display using the Format property of that field (at the Query level). All you have to do to do that is right-click on the field in Query Design View, select Properties, and poulate the Format property with something like mmmm yyyy.

    So I don't see any real need to copy this field over to a new field at all. Even if you do, you just set the value to equal the value of the other field, and appy the desired Format at the Table/Query level. No special calculation is needed.
    Thank you very much for providing this solution, which of course is the perfect solution. I did not fully appreciate it when you initially posted it. I must have read your post too quickly.

  4. #19
    Chuck is offline Advanced Beginner
    Windows 10 Access 2003
    Join Date
    Jul 2019
    Posts
    49
    To be clear, the solution that I used was the one contained here: " All you have to do to do that is right-click on the field in Query Design View, select Properties, and populate the Format property with something like mmmm yyyy."

Page 2 of 2 FirstFirst 12
Please reply to this thread with any new information or opinions.

Similar Threads

  1. How to manage parametric SQL query answer
    By motociap in forum Modules
    Replies: 2
    Last Post: 05-26-2017, 01:30 AM
  2. Replies: 0
    Last Post: 06-17-2016, 05:32 PM
  3. Replies: 4
    Last Post: 12-30-2013, 05:51 PM
  4. How to manage the manage the input of data?
    By Gambit17 in forum Import/Export Data
    Replies: 4
    Last Post: 07-30-2013, 10:32 AM
  5. Replies: 12
    Last Post: 04-03-2012, 06:31 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums