Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

query & form help please !

Discussion in 'Information Technology' started by Nikko, Jul 28, 2006.

Tags:
  1. Nikko

    Nikko
    Expand Collapse
    Guest

    hello ,

    Is it possible to enter a query as a source for a textlabel or textbox ?

    for exemple : select firm_name from FIRM where id in (select id_firm
    from EMPLOYEE where id=XXX)

    thank you
     
  2. Loading...

    Similar Threads Forum Date
    Query about Jhatka Meat by Shooting in Head Sikh Sikhi Sikhism Aug 26, 2011
    Who is a sikh? A non sikh friend's query!! Sikh Sikhi Sikhism Apr 30, 2010
    General Query Hard Talk Sep 4, 2008
    Power of pauri's in Japji Sahib query Sikh Sikhi Sikhism Aug 17, 2006
    Sikhism a query Book Reviews & Editorials Aug 2, 2005

  3. Bob Barnes

    Bob Barnes
    Expand Collapse
    Guest

    YES - I do that with Unbound Forms, w/ of course Unbound
    Controls.

    With the recordset you generate, you can put those values
    into the unbound textboxes.

    HTH - Bob


    "Nikko" wrote:

    > hello ,
    >
    > Is it possible to enter a query as a source for a textlabel or textbox ?
    >
    > for exemple : select firm_name from FIRM where id in (select id_firm
    > from EMPLOYEE where id=XXX)
    >
    > thank you
    >
     
  4. Douglas J Steele

    Douglas J Steele
    Expand Collapse
    Guest

    Despite what Bob said, it's not possible. You cannot use a SQL statement as
    the control source for a control.

    For a textbox, you could use:

    =DLookup("firm_name", "FIRM", "id = " & DLookup("id_firm", "EMPLOYEE",
    "id='XXX'"))

    (including the equal sign), but that is a hard-coded XXX: if you wanted to
    be able to vary what XXX was, you'd be out of luck.

    For the caption of a label, your only option would be to set it in VBA code:

    Me.MyLabel.Caption = DLookup("firm_name", "FIRM", "id = " &
    DLookup("id_firm", "EMPLOYEE", "id='XXX'"))

    Here, since you're using VBA, you'd be able to change XXX:

    strCurrID As String

    strCurrID = "XXX"
    Me.MyLabel.Caption = DLookup("firm_name", "FIRM", "id = " &
    DLookup("id_firm", "EMPLOYEE", "id='" & strcurrID & "'"))

    --
    Doug Steele, Microsoft Access MVP
    http://I.Am/DougSteele
    (no e-mails, please!)


    "Nikko" <hum@free.fra> wrote in message
    news:4460ae0c$0$25540$626a54ce@news.free.fr...
    > hello ,
    >
    > Is it possible to enter a query as a source for a textlabel or textbox ?
    >
    > for exemple : select firm_name from FIRM where id in (select id_firm
    > from EMPLOYEE where id=XXX)
    >
    > thank you
     
  5. Bob Barnes

    Bob Barnes
    Expand Collapse
    Guest

    Doug - Perhaps there's a miscommunication.

    Using an Unbound Form, and Unbound Controls...I use A Query, or SQL
    Statement, to get a Recordset. Then With that recordset, it's very easy to
    populate the textboxes. I've been doing it for years. One of my Clients is
    a major Automaker. They request my Forms to be built that way.

    Bob

    "Douglas J Steele" wrote:

    > Despite what Bob said, it's not possible. You cannot use a SQL statement as
    > the control source for a control.
    >
    > For a textbox, you could use:
    >
    > =DLookup("firm_name", "FIRM", "id = " & DLookup("id_firm", "EMPLOYEE",
    > "id='XXX'"))
    >
    > (including the equal sign), but that is a hard-coded XXX: if you wanted to
    > be able to vary what XXX was, you'd be out of luck.
    >
    > For the caption of a label, your only option would be to set it in VBA code:
    >
    > Me.MyLabel.Caption = DLookup("firm_name", "FIRM", "id = " &
    > DLookup("id_firm", "EMPLOYEE", "id='XXX'"))
    >
    > Here, since you're using VBA, you'd be able to change XXX:
    >
    > strCurrID As String
    >
    > strCurrID = "XXX"
    > Me.MyLabel.Caption = DLookup("firm_name", "FIRM", "id = " &
    > DLookup("id_firm", "EMPLOYEE", "id='" & strcurrID & "'"))
    >
    > --
    > Doug Steele, Microsoft Access MVP
    > http://I.Am/DougSteele
    > (no e-mails, please!)
    >
    >
    > "Nikko" <hum@free.fra> wrote in message
    > news:4460ae0c$0$25540$626a54ce@news.free.fr...
    > > hello ,
    > >
    > > Is it possible to enter a query as a source for a textlabel or textbox ?
    > >
    > > for exemple : select firm_name from FIRM where id in (select id_firm
    > > from EMPLOYEE where id=XXX)
    > >
    > > thank you

    >
    >
    >
     

Share This Page