Results 1 to 2 of 2
  1. #1
    A Abbas is offline Novice
    Windows 7 32bit Access 2010 32bit
    Join Date
    Nov 2011
    Posts
    4

    Multiplying two fields in a form from different tables

    Hi,

    I am new to access and dont know VB also. I will be really grateful if someone can help me on this.
    I have two tables 'LabIssue' and 'Store'.
    I created a form for 'LabIssue' in which data will be entered. In the form I want to calculate the 'ChemicalAmount' by multiplying 'Store.Costperunit' with the 'QuantityIssued' which will be entered by the user. ChemicalAmount and QuantityIssued will be stored in 'LabIssue' table. I tried it through the expression builder but im getting #Name? error, did alot of things but couldnt figured out whats the problem.


    I am attaching the initial database also for reference. please help me, its really urgent.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,930
    The #NAME error means Access can't find a reference. The table Store is not included in the form's RecordSource, therefore the field CostPerUnit is not available for the calculation.

    The Relationships setup doesn't make sense. The purpose of table Relationships is to associate primary and foreign key fields. The data in the joined fields must be the same. This is how tables are related. You have included CheAmount in a join to CostPerUnit but on the form CheAmount is a calcuation that uses CostPerUnit. Since the two fields cannot be the same, this join is meaningless. Recommend you set the Autonumber field in Store as primary and add a field in LabIssue to save this value as foreign key and set Relationships to reflect that, if I correctly understand these tables' relationship.

    Also, calculated results do not save to table without code and there should be no reason to save CheAmount. Perform this calculation as needed.
    Last edited by June7; 11-03-2011 at 09:29 AM.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Multiplying two tables question
    By mmanzo1001 in forum Access
    Replies: 10
    Last Post: 10-14-2011, 10:14 AM
  2. "multiplying" fields
    By werfnerf in forum Queries
    Replies: 3
    Last Post: 05-27-2011, 01:59 PM
  3. Multiplying Values from a form and table
    By Lxmanager in forum Access
    Replies: 5
    Last Post: 02-19-2011, 07:07 PM
  4. Multiplying
    By chazcoral2 in forum Forms
    Replies: 16
    Last Post: 09-10-2010, 01:44 PM
  5. Complex Form Question - 2 Tables, Different Fields
    By nichojo in forum Programming
    Replies: 6
    Last Post: 08-03-2010, 07:12 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