Results 1 to 5 of 5
  1. #1
    stephanie77 is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2016
    Posts
    14

    Question Multiple label caption in reports (depending on customer language)

    I've search a lot on the web and didn't find anything near what I would like to get/do in my DB so again, I'm begging for your help and creativity!!

    I would like Access to manage automatically the caption of my labels (and fields ultimately via a lexique or something like that but let's stick to the darn labels first) in a report, based on the language of for example, the customer to whom this report is dedicated (report=invoice).

    I only have two choices to deal with : french or english



    Just so you know, each company in my customers and suppliers tables have a field that specifies which language they are doing business in.

    I don't need the translation for users, but really on pdf/printed/extract reports (I specify cause all I have found on the web was translation for the DB users!!!)

    I ask for multiple label captions cause that's the only way I could think of doing this but if you have better idea, please inspire me!

    Thanks in advance!

  2. #2
    Micron is offline Virtually Inert Person
    Windows 7 32bit Access 2007
    Join Date
    Jun 2014
    Location
    Ontario, Canada
    Posts
    12,791
    I think this would be easier with textboxes that look like labels as opposed to actual labels. No idea where your two sets of data comes from, but if you have a 'language' flag as you say, why not have a query return all the values to the report controls being used as labels? One query could be for French, the other English. The proper query could be opened based on the language flag.
    Last edited by Micron; 01-30-2017 at 07:13 PM. Reason: grammar
    The more we hear silence, the more we begin to think about our value in this universe.
    Paraphrase of Professor Brian Cox.

  3. #3
    CJ_London is offline VIP
    Windows 10 Access 2010 32bit
    Join Date
    Mar 2015
    Posts
    11,412
    Sounds like you need a translation table - something like

    English.................French
    Customer..............Client
    Invoice Number.....Numéro de Facture

    Although I would suggest something more normalised if you have many languages

    In your customer table, have a field to indicate language

    then in your report, if language=French then loop through each label and swap the text

    something like

    Code:
    if language=French then
    for each ctrl in me.controls
        if ctrl.controltype=aclabel then ctrl.caption=nz(dlookup("French","tblTranslations","English='" & ctrl.caption "'"),ctrl.caption)
    next ctrl
    or you can have a table to store name of report, name of control, language and phrase

    reportname...controlname...language...phrase
    Invoice.........lblInvNo.........1..............In voice Number
    Invoice.........lblInvNo.........2..............Nu méro de Facture

    etc

    and a similar loop

    Code:
    set rst.currentdb.opnrecordset("SELECT * FROM tblCaptions WHERE reportname='" & me.name & "'")
    while not rst.eof
        me(rst!controlname).caption=rst!phrase
        rst.movenext
    wend

  4. #4
    NTC is offline VIP
    Windows 10 Access 2013
    Join Date
    Nov 2009
    Posts
    2,392
    So both M and A have provided advanced examples with a table driven design. If a less complex solution meets your need you can make a duplicate of each label by language, arrange them on top of each other - and then in the On Format of the report section manage which labels are visible.

    For instance have the user select which language report they seek - and use that flag as the criteria.

    Toggling visibility of labels is typically more advantageous than making an entire duplicate set of reports by language. Although if the report count is low and it is certain they will not be redesigned - duplicate reports could be considered. However it can become a real trap as each redesign must be done twice.

    Managing visibility of labels is simpler, in the programming sense, than a table driven approach. However if you have lots of reports and lots of languages then the table driven design will be far more efficient in the long run. So your implementation method depends on your requirements.

  5. #5
    stephanie77 is offline Novice
    Windows 10 Access 2016
    Join Date
    Dec 2016
    Posts
    14
    Wow, that's creativity!! Thanks a lot everyone!

    I will have many reports to produce so I guess I'd better go with the translation table

    Will do some tests with your propositions Ajax and see how it goes... stay tuned!

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Label Caption string with global variable
    By sstiebinger in forum Programming
    Replies: 2
    Last Post: 08-24-2015, 11:30 AM
  2. Result of query into label.caption ?
    By SpookiePower in forum Queries
    Replies: 7
    Last Post: 12-17-2013, 01:56 PM
  3. Getting Value as label Caption
    By Naveen Marapaka in forum Forms
    Replies: 4
    Last Post: 09-18-2013, 12:22 AM
  4. Replies: 6
    Last Post: 01-16-2013, 12:12 PM
  5. Set Label.Caption to field of recordsource
    By ngruson in forum Forms
    Replies: 1
    Last Post: 08-11-2010, 09:59 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