Results 1 to 2 of 2
  1. #1
    NateHaze is offline Novice
    Windows XP Access 2007
    Join Date
    May 2011
    Posts
    6

    program a text box in a report!

    Here is my example:

    I am trying to set the value of a text box based on the "Age" field in MyQuery. I have the textbox's Control Source set to =MyFunction(). The report's record source is MyQuery. Here is my function:

    Public Function MyFunction() As String


    If [MyQuery.Age] = "100" Then
    MyFunction = "This guy is old!"
    End If
    End Function

    I just don't know the syntax to reference the age field.
    I tried [MyQuery].[Age],[MyQuery]![Age],[MyQuery].[Age].Value, etc...

    Help!

  2. #2
    SoftwareMatters is offline Access VBA Developers
    Windows XP Access 2003
    Join Date
    Mar 2009
    Location
    Dorset
    Posts
    274
    Is MyQuery a query and if so is the report based on it?
    If not is it open when the report is opened?

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

Similar Threads

  1. Program a 30-day trial into my Access Program?
    By genghiscomm in forum Programming
    Replies: 1
    Last Post: 05-26-2011, 02:14 PM
  2. Weird Text on Report
    By j2curtis64 in forum Reports
    Replies: 1
    Last Post: 05-03-2011, 03:16 PM
  3. Replacing text for a report
    By Zaram in forum Reports
    Replies: 7
    Last Post: 02-23-2010, 12:27 PM
  4. report text scrolls away when try to C & P
    By noniknonik in forum Access
    Replies: 0
    Last Post: 06-09-2009, 07:04 AM
  5. How to format text in a report
    By Kimelco in forum Access
    Replies: 1
    Last Post: 01-06-2006, 07:30 PM

Tags for this Thread

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