Results 1 to 5 of 5
  1. #1
    cmdturk is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    3

    access 2007; sql query in a field?

    hello,


    i want to have a cell that shows an sql query and sth like formula. for example;
    table1 fields: ID, WareName, Total, Came, Remaining
    table2 fields: ID, RelatedID, Came, Date, Comment

    table1.Came and table1.Remaining must be automated values:
    table1.Came=select sum(t2.Came) from table2 as t2 where t2.RelatedID=ID;
    table1.Remaining=Total-Came

    how can i do that?
    thank you,
    mustafa öztürk

  2. #2
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    I must not understand your question, as the answer is too easy....just put that text into an unbound text box....

  3. #3
    cmdturk is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    3
    Quote Originally Posted by NTC View Post
    I must not understand your question, as the answer is too easy....just put that text into an unbound text box....
    thanks,
    but i am unable to get sql query in a text box. i inserted a text box on the auto generated form and write in it: "=(select sum(t2.Came) from t2 where t2.RelatedID=ID)"

    the second text box is "=[total]-[txtCame]"

    both give error.

    but if i write "=[total]*2" it works.

    i attached the sample accdb file.

    thank you for your answer,

  4. #4
    NTC is offline VIP
    Windows Vista Access 2007
    Join Date
    Nov 2009
    Posts
    2,392
    ah - I thought you simply wanted to display the syntax

    you want to actually run the sql...

    Access is event driven - so to run a query you must put that statement at an event...tab event, afterupdate, form current....some event - - not in a passive textbox control....

  5. #5
    cmdturk is offline Novice
    Windows Vista Access 2007
    Join Date
    Dec 2009
    Posts
    3
    Quote Originally Posted by NTC View Post
    ah - I thought you simply wanted to display the syntax

    you want to actually run the sql...

    Access is event driven - so to run a query you must put that statement at an event...tab event, afterupdate, form current....some event - - not in a passive textbox control....
    can you tell how to do it?

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

Similar Threads

  1. Replies: 3
    Last Post: 12-15-2009, 01:47 PM
  2. Replies: 0
    Last Post: 11-17-2009, 02:35 PM
  3. How does Access guess join field in query?
    By bar tomas in forum Database Design
    Replies: 1
    Last Post: 05-27-2009, 05:56 PM
  4. Replies: 3
    Last Post: 03-27-2009, 06:50 AM
  5. Replies: 1
    Last Post: 10-09-2008, 04:48 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