Results 1 to 8 of 8
  1. #1
    diane802 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    92

    Access 2007: Create Expression as Field in the Table

    I have a table where I want to create a calculation based upon two other fields in the table.



    I am in Design View of this table.

    I created the Field Name, Data Type: Number

    Under Field Properties, I am on the General tab, and under "Default Value", I clicked on the "Build ..." button, but when I open it - it does not show any of my Table fields (which usually does exist in Form view).

    I tried typing in the calcuation by doing:

    =[Field 1 Name] * [Field 2 Name]

    But when I click View table - it says:

    The database engine does not recognize either the field 'Field 1 Name' in a validation expression, or the default value in the table 'Table 1'

    Advice please?

  2. #2
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    To start with, you do not want to store a calculation in a table for a number of reasons. Second, create a query that performs the calculation for you.

  3. #3
    diane802 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    92
    once I have created it in a query, how do I add this field to show up in my form?

  4. #4
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Calculated query fields are just as real as table fields to a form. Just bind your control to that field.

  5. #5
    diane802 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    92
    Sorry - first time I am doing this.

    I have created a text box in the form. Then under Design view, I went to Property Sheet / Data tab:
    Control Source - I made it equal to the field from the Query I want to show

    When I go back to View, it shows the Name error: #Name?

    What am I doing wrong?

  6. #6
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Have you bound the form to your query with the calculation? When you selected the ControlSource, did you use the cbo DropDown to select the field?

  7. #7
    diane802 is offline Advanced Beginner
    Windows XP Access 2007
    Join Date
    Dec 2009
    Posts
    92
    Apologies I figured it out thanks.

  8. #8
    RuralGuy's Avatar
    RuralGuy is offline Administrator
    Windows XP Access 2002
    Join Date
    Mar 2007
    Location
    8300' in the Colorado Rocky Mountains
    Posts
    12,922
    Glad I could help.

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

Similar Threads

  1. Replies: 5
    Last Post: 05-04-2019, 09:02 PM
  2. Replies: 1
    Last Post: 05-13-2010, 10:50 AM
  3. access 2007; sql query in a field?
    By cmdturk in forum Access
    Replies: 4
    Last Post: 12-16-2009, 10:25 AM
  4. Replies: 3
    Last Post: 12-15-2009, 01:47 PM
  5. Replies: 3
    Last Post: 03-27-2009, 06:50 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