Results 1 to 5 of 5
  1. #1
    Naveen Marapaka is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    33

    Getting Value as label Caption

    Hi dear, I have 2 tables and I made a query to get the Dsum of a field in 2 tables.



    as Select Sum(In_Court_S_A_F_U)-Dsum("Out_Court_S_A_F_U","RV_Outgoing") From RV_Incomming;


    It is working well in access when i run it as a query.



    I have Form in which a Label Named LBL1, So i want LBL1 caption to be the result of above query when Form Loads

    how can i get it

    pls advise.

  2. #2
    Ruegen's Avatar
    Ruegen is offline VIP
    Windows 7 64bit Access 2010 64bit
    Join Date
    Jul 2013
    Location
    Australia
    Posts
    1,496
    1. Does the form have the query as the record source?

    2. Is the query displaying the right information?

    If it is displaying a result you can drag in that field on to the main form and it should display on the record.

  3. #3
    Naveen Marapaka is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    33
    Hi,

    No Form dont have the query as record souce,
    I need Coding which system accepts as VBA how can i run and display the result on LBL1 when form loads.

    My query is simply and it is working when i directly runs as access query.

    regards

  4. #4
    HuubVanOers is offline Novice
    Windows Vista Access 2007
    Join Date
    Sep 2013
    Posts
    2
    Quote Originally Posted by Naveen Marapaka View Post
    Hi dear, I have 2 tables and I made a query to get the Dsum of a field in 2 tables.

    as Select Sum(In_Court_S_A_F_U)-Dsum("Out_Court_S_A_F_U","RV_Outgoing") From RV_Incomming;

    It is working well in access when i run it as a query.

    I have Form in which a Label Named LBL1, So i want LBL1 caption to be the result of above query when Form Loads

    how can i get it

    pls advise.

    Hi Naveen
    on the form onload event (properties of the form, tabpage events)
    first use a function in the form, not the select like: rv = dsum(...) etc
    then set the result (rv) as lbl1.caption = rv (if jyou want to do it nice use cstr(rv), to make it text


    gr, Huub

  5. #5
    Naveen Marapaka is offline Advanced Beginner
    Windows 7 32bit Access 2010 32bit
    Join Date
    Dec 2012
    Posts
    33
    Hi Gr,

    thank you for the suggestion.
    i got your point and it worked , thank you again.
    DSum("In_Court_S_A_F_U", "RV_Incomming") - DSum("Out_Court_S_A_F_U", "RV_Outgoing")

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

Similar Threads

  1. Replies: 6
    Last Post: 01-16-2013, 12:12 PM
  2. Dynamic Datasheet Caption
    By Jester0001 in forum Forms
    Replies: 4
    Last Post: 05-30-2012, 01:13 PM
  3. Using a Labels Caption Programmatically
    By ksmith in forum Programming
    Replies: 2
    Last Post: 10-12-2010, 01:10 PM
  4. Set Label.Caption to field of recordsource
    By ngruson in forum Forms
    Replies: 1
    Last Post: 08-11-2010, 09:59 AM
  5. Replies: 1
    Last Post: 03-24-2010, 02:25 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