Results 1 to 5 of 5
  1. #1
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    inserting a variable into a label

    Hi



    I have a list of 95 parish records that I am converting from excel to access.

    I am using one church to create the database and then it will be used as a template for the other 94 parish records.

    At the top of the opening form there is a label that says:

    "Westbury Parish Records"

    I have the complete list of parishes in a table with two fields PlaceName and ID

    How do I insert a "variable" into my titles so that If I alter one they are all changed?

    I'm sure it can be done but I'm not sure what my question is to search google

    thanks

    Ian

  2. #2
    Perceptus's Avatar
    Perceptus is offline Expert
    Windows 7 64bit Access 2007
    Join Date
    Nov 2012
    Location
    Knoxville, Tennessee
    Posts
    659
    have you tried working with TempVars?

  3. #3
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453
    Hi

    I do use tempVars but I'm not at all sure how to include it in a label

    ie so it would read "TEmpVar Parish Records" as the page header so that if tempvar was set to Westbury it would read "Westbury Parish Records"

    cheers

    Ian

  4. #4
    SuperAccessNinjas is offline Novice
    Windows 10 Access 2013 64bit
    Join Date
    Mar 2016
    Posts
    8
    If I'm reading this right, a calculated text box may be a solution. Something like =[PlaceName] & " Parish Records". Don't forget the space at the front of the second part in quotes. It's similar to a concatenate function in excel. I use this all the time in forms and reports.

  5. #5
    Jen0dorf is offline Competent Performer
    Windows 10 Access 2010 32bit
    Join Date
    Jul 2015
    Location
    UK
    Posts
    453

    confusion

    Hi

    as usual I’ve dug myself into a confusing maze!!

    Just to reiterate what I'm trying to acheive.

    I'm trying to set up a variable such as Westbury Parish Records so that if on every form I put some code such as

    Code:
    varPlace
    Then I'll only ever have to change one value to update all my forms.

    So I created a simple table one record. The table is called tbl_text the one record is called Place and it’s value is westbury.

    So I created a form using the wizard based on the table.- double click on the form and up it comes displaying the one value "Westbury"

    I have another form called frm_westbury which is the opening form of the database. and in the header is a label which at the moment says "Westbury Parish Records"

    On that form I added another label and in the properties gave it the value

    =[varPlace]&” Parish Records”

    the idea being that Westbury is loaded as a variable followed by the text Parish Records

    In the form onload property I used the macro build option to do the following:

    Macro One opens the form frm_Text

    Macro 2 next

    I used the

    Code:
    SetTempVar
    name VarPlace
    expression=[tbl_text]![place]
    Macro 3 just closes the form rm_text

    Which I thought would create my variable varPlace and make it available on the form when it opened.


    I save the form and then opened frm_westbury

    and I get the following error:

    the object does not contains the Automation object “tbl_txt” ……..the object does not make the property or method available for Automation operations

    the object does not contain the automation object

    I am now totaly lost and confused, am I being to complicated? Over the years I've installed loads of software where if I input my details it's automaticaly inserted throughout the program.

    Would really appreciate some help

    thanks

    Ian

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. using dynamic label/variable name
    By Eef in forum Programming
    Replies: 4
    Last Post: 10-19-2014, 06:24 AM
  3. Replies: 1
    Last Post: 04-25-2014, 11:41 AM
  4. Update Query, Inserting Variable Number of "0"
    By bigchicagobob in forum Queries
    Replies: 4
    Last Post: 03-25-2014, 07:33 AM
  5. Inserting a variable into a SQL statement
    By adacpt in forum Programming
    Replies: 3
    Last Post: 11-25-2012, 06:02 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