Page 1 of 2 12 LastLast
Results 1 to 15 of 27
  1. #1
    mar7632 is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    Spain - Madrid
    Posts
    72

    format does not work

    Hello,



    Related to a format I have stablished in a date/hour field called "CodigoRFQ" which is "yyyy-ww-w hh:nn" and it is located in a form. Then I call that record to a report then convert into a pdf in order to send it via OutLook.

    The pdf´s title is the same as "codigoRFQ" for a determine record and in order to obtain it I use this code:

    Code:
    Private Sub Report_Load()
    If CurrentProject.AllForms("Faa_DatosRecibidos").IsLoaded Then
    Me.Caption = Forms![Faa_DatosRecibidos]![codigoRFQ]
    End If
    End Sub
    However, when the pdf is uploaded the pdf´s title I obtain has the following format: "dd_mm_yyyy_hh_mm_ss"

    How do I solve this problem?

    Thanj you in advance.

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,521
    so viewing the report in PrintPreview, the format is correct,
    but exporting it to PDF, alters it to the incorrect format?

  3. #3
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    You haven't showed the pdf creation code.

    The : character is illegal in the file name I believe.
    And I personally wouldn't want to save a file with that many spaces and characters in it. It makes referring to it so much harder.
    The current format actually looks more sensible to my eye.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  4. #4
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,398
    I suspect you are using the format property in your codigoRFQ control. Properties only impact the controls they are applied to. If a control is created based on an underlying field then it will inherit the format of that field at the time of creation. Suggest try

    Me.Caption = format(Forms![Faa_DatosRecibidos]![codigoRFQ],"yyyy-ww-w hh:nn")

  5. #5
    mar7632 is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    Spain - Madrid
    Posts
    72
    Hello, thank you for your responses.

    Sorry because I am changing my mind every time haha.
    I am wondering if it is possible to have in a field like a combination of multiple fields.

    For example: in the field called “codigoRFQ” takes the value which are contained in a date/hour field plus text field plus the ID field. In order to obtain in this “codigoRFQ” field something like this:
    Date field: 2019/12/15
    Text field: thu
    ID: 2
    codigoRFQ = 20191215-THU-2


    Is this possible?

    Thank you and I apologize for any inconvenience caused.
    Last edited by mar7632; 03-15-2019 at 11:10 AM. Reason: Words

  6. #6
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Yes - but you don't need to store it as all the parts are already in place, and what benefit does the THU give you - you already have the date.
    You need to make your mind up about what this is for how it helps you.

    Code:
    MyCalulatedNotStoredField: Format([YourDate],"yyyymmdd") & "-" & ID
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  7. #7
    June7's Avatar
    June7 is online now VIP
    Windows 10 Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,825
    According to a related thread, THU is abbreviation for a factory location.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  8. #8
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    Quote Originally Posted by June7 View Post
    According to a related thread, THU is abbreviation for a factory location.
    Ah - Thanks June, my poor interpretation.

    Still doesn't need storing
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  9. #9
    mar7632 is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    Spain - Madrid
    Posts
    72
    So I have the following fields:
    [factory_code]
    [entry_date]
    [Id_item]
    How do I introduce this field into [CodigoRFQ] which is in a form?
    So when I finish introducing the data, it updates codigoRFQ with this format yyyymmdd-[factory_code]-[Id_item]

    MyCalulatedNotStoredField: Format([YourDate],"yyyymmdd") & "-" & ID
    This is made by doing a event after_update?

    Please, help

  10. #10
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    As everyone has said more than once you don't and shouldn't store this.
    You can calculate and display it at any stage in your operation, and if any of those fields get changed you don't have to worry about trying to update the stored value.

    So in your forms Underlying query
    Code:
    codigoRFQ : Format([YourDate],"yyyymmdd") & "-" & [Factory_Code] & "-" & [ID_Item]
    Or on an unbound text control on your form in the Control Source

    Code:
    = Format([YourDate],"yyyymmdd") & "-" & [Factory_Code] & "-" & [ID_Item]
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  11. #11
    mar7632 is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    Spain - Madrid
    Posts
    72
    Hi everyone,

    I followed your instructions. I wrote in control source on a unbound text: = Format([fecha_entDT],"yyyymmdd")&"-"&[CODIGO_planta]&"-"&[id_item]
    But a message appears related to guide to expression syntax.

    any idea?

  12. #12
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    What is the message?
    Try using the expression builder as it will make sure all the field names etc. are correct.
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  13. #13
    mar7632 is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    Spain - Madrid
    Posts
    72
    I wrote: =Format([fecha_entDT];[yyyymmdd]) & "-" & [CODIGO_planta] & "-" & [id_item]
    But the text box shows -> #Name?
    The message was something like I need to use the correct syntax.

  14. #14
    Minty is offline VIP
    Windows 10 Access 2016
    Join Date
    Sep 2017
    Location
    UK - Wiltshire
    Posts
    3,001
    The semicolon is incorrect, it should be a comma, and you need quotes around the format string not square brackets...
    Code:
    =Format([fecha_entDT],"yyyymmdd") & "-" & [CODIGO_planta] & "-" & [id_item]
    DLookup Syntax and others http://access.mvps.org/access/general/gen0018.htm
    Please use the star below the post to say thanks if we have helped !
    ↓↓ It's down here ↓↓

  15. #15
    mar7632 is offline Advanced Beginner
    Windows 8 Access 2016
    Join Date
    Feb 2019
    Location
    Spain - Madrid
    Posts
    72
    It does not work I wrote the same as you told me. Access is telling me that the expression builder syntax is not correct.

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

Similar Threads

  1. Replies: 15
    Last Post: 11-27-2017, 02:34 PM
  2. Replies: 3
    Last Post: 12-30-2016, 10:27 AM
  3. Replies: 4
    Last Post: 12-06-2014, 08:49 PM
  4. Replies: 0
    Last Post: 11-19-2014, 05:47 AM
  5. Replies: 4
    Last Post: 03-12-2013, 06:49 PM

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