Results 1 to 5 of 5
  1. #1
    TOMMY.MYERS668's Avatar
    TOMMY.MYERS668 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Location
    West Virginia
    Posts
    77

    report not displaying variable that was entered thru code

    Ok side tracked by the army to start something else before i finished with the last project.
    This database should be uber simple. Its got some more variables to go into it yet of course but right now im just trying to get it to print and address line that it pulls from a table in code.
    so far it pulls and displays the signature line fine but the address line do not show up in the report. As far as I can tell the code looks right. and there is only one battalions info in the adress table and that is FIRST BDE (QM) anything else and it will throw an error. I have the following code in after update for selecting the battalion. :

    Private Sub BATTALION_AfterUpdate()


    If Not IsNull(Me![BATTALION]) Then
    Dim ADDRESSPICK1 As String
    Dim ADDRESSPICK2 As String
    Dim SIGNATUREPICK As String
    ADRESSPICK1 = DLookup("[ADDRESS 1]", "[UNIT ID TABLE]", "[UNIT NAME]='" & Me![BATTALION] & "'")
    ADRESSPICK2 = DLookup("[ADDRESS 2]", "[UNIT ID TABLE]", "[UNIT NAME]='" & Me![BATTALION] & "'")
    SIGNATUREPICK = DLookup("[SIGNATURE BLOCK]", "[UNIT ID TABLE]", "[UNIT NAME]='" & Me![BATTALION] & "'")
    'ASSIGN VARIABLE TO ACCESS VARIABLES
    Me![ADDRESS LINE 1] = ADDRESSPICK1
    Me![ADDRESS LINE 2] = ADDRESSPICK2
    Me![SIGNATURE] = SIGNATUREPICK
    'PRAY
    End If

  2. #2
    TOMMY.MYERS668's Avatar
    TOMMY.MYERS668 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Location
    West Virginia
    Posts
    77
    Never mind I'm an idiot I found the mispelling in both vaiable thanks much if anyone actually looked at this yet.

  3. #3
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    The best practice, for anyone who uses Variables, is to set the Require Variable Declaration Property. From that time forward, whenever you create a Form, Access will automatically place 'Option Explicit' at the top of the Code Module, and when you try to run a procedure on that Form with an Undeclared Variable (and a misspelled Variable will obviously have not been declared) the Access Gnomes will scream and holler, telling you so, and take you to the offending Variable!

    To do that

    1. Go into the Code Module on any Form
    2. On the Menu go to Tools
    3. Click Options
    4. Go to the Editor (Not Editor Format!!!) Tab
    5. Under 'Code Settings' tick the box marked "Require Variable Declaration"
    6. Click Okay

    Linq ;0)>

  4. #4
    TOMMY.MYERS668's Avatar
    TOMMY.MYERS668 is offline Advanced Beginner
    Windows 7 64bit Access 2007
    Join Date
    Feb 2013
    Location
    West Virginia
    Posts
    77
    hey thanks much never knew that was there.

  5. #5
    Missinglinq's Avatar
    Missinglinq is offline VIP
    Windows 7 64bit Access 2007
    Join Date
    May 2012
    Location
    Richmond (Virginia, not North Yorkshire!)
    Posts
    3,018
    It's one of the Options I always thought should be turned on by default, rather than turned off by default.

    Good luck with your project!

    Linq ;0)>

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

Similar Threads

  1. Replies: 20
    Last Post: 09-04-2012, 10:56 AM
  2. Replies: 3
    Last Post: 04-25-2012, 02:14 PM
  3. Replies: 0
    Last Post: 08-10-2011, 11:59 AM
  4. Replies: 3
    Last Post: 10-15-2010, 11:17 AM
  5. Replies: 23
    Last Post: 03-26-2009, 06:50 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