Results 1 to 6 of 6
  1. #1
    geraldk is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    49

    multiple queries in form

    Hello,



    Please forgive if someone else ask this question. I am programming a new database for my work. I am having a problem to get two queries in a form. I have query to bound some text boxes into my form. I need to add another query for some calculation and display the results in a text box. Right now I have tried to put Control Source into a macro and when the form is ran it comes with #Name? error.

    If someone has some suggestions to me it would be appreciated.

    Thank you in advance.

    Season Greetins!

    Using Access 2010 32bit.

  2. #2
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    We need to know more about data structure and the data manipulation you want to do. It is possible one query can accomplish what you want or maybe a form/subform arrangement is called for.
    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.

  3. #3
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    One Form can only have one Query as its Record Source.

    Although that one Query could comprise multiple Queries/Tables.

    What does this Calculation Query do? What is its Record Source. Is it the same as the Main Query.

  4. #4
    geraldk is offline Advanced Beginner
    Windows 7 64bit Access 2010 32bit
    Join Date
    Dec 2011
    Posts
    49
    I beleive I have this database set up as ADO format.

    This is the query that I have setup for control for the form:

    SELECT tblEmpVac.EMPID, tblEmpVac.VACID, tblEmpVac.EMPVACDate, tblEmpVac.EMPVACID
    FROM tblEmpVac;

    This is the unbound sql that I want to display at another text box on the form.

    SELECT Count(vacid) AS VAC
    FROM tblempvac
    WHERE (((tblempvac.vacid)=1) And ((tblempvac.empid)=forms!frmEmployee!EmpID));

    Basicly this database is employee database for HR department to keep track of some vacations days that they taken.

  5. #5
    Rainlover's Avatar
    Rainlover is offline Expert
    Windows 7 64bit Access 2003
    Join Date
    Nov 2009
    Location
    Queensland Australia
    Posts
    691
    Have a look at Access Help or Google the Function "DSum"

    This will give you what you need instead of using the second Query.

    If you really wanted to do this with a Query you would have to do it in Code and create a Recordset Clone.

    Finally, could you not add the where clause to the first query or do you want the Form to show all records which include those outside of your where conditions.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows XP Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    53,771
    Is purpose of this form to enter vacation records? You want to count the number of vacation days for each employee for each vacation ID? Yes, could use DSUM function to show the count in a textbox. Domain aggregate functions can slow performance but if not too many records might not be so noticeable. Ideally, create a report to output this aggregate data.

    The form RecordSource includes all records. The Count you show is limited to a specific VACID. This will put the Count out of sync with the form. Need to either filter the form RecordSource to specific VACID or also use dynamic parameter as you have done with the EMPID.
    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. Form with Tabs and multiple external queries
    By chris.williams in forum Forms
    Replies: 3
    Last Post: 11-16-2011, 06:20 PM
  2. SQL Multiple Queries
    By mbake085 in forum Queries
    Replies: 5
    Last Post: 05-13-2011, 01:03 PM
  3. Form queries. Multiple checkboxes.
    By radink in forum Queries
    Replies: 4
    Last Post: 04-27-2011, 07:34 AM
  4. Multiple Duplicate Queries in One?
    By NewtoIT in forum Programming
    Replies: 0
    Last Post: 03-10-2011, 04:57 PM
  5. Replies: 0
    Last Post: 03-19-2006, 11:52 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