Welcome to SPN

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

Sign Up Now!

Really basic question - easiest way to just display ONE record from a table?

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

  1. Angus Comber

    Angus Comber
    Expand Collapse
    Guest

    Hello

    I want to display just one row from a table.

    Eg: SELECT * FROM Table1 WHERE xyzID = SomeValue

    I can do it all in code but am hoping because it is Access I can maybe do it
    with limited code?

    Eg on one form I have the SomeValue - want to then in OnClick Event pass
    SomeValue to say a query to get data for form?

    Hope I am explaining myself ok.

    How do I do that?

    Form will be standard fields - eg text fields displaying row data.

    Angus
     
  2. Loading...

    Similar Threads Forum Date
    Opinion Feeling Of Turban On Head 'really Gratifying': Ben Kingsley Sikh Sikhi Sikhism May 26, 2016
    Who Are The Sikhs, Really ? Questions and Answers Feb 7, 2016
    The Illusion Of matter: Our Physical World Really Isn't Physical At All General Nov 26, 2015
    You have no idea how badass Trudeau's Defence Minister really is! Sikh Personalities Nov 7, 2015
    Controversial Raagmala - Is It Really Part Of Gurbani? Hard Talk Oct 14, 2015

  3. Sprinks

    Sprinks
    Expand Collapse
    Guest

    RE: Really basic question - easiest way to just display ONE record fro

    Angus,

    To use the current record as a filter for opening a second form, pass the
    value to the Where parameter of the Openform method. This is most easily
    done by enabling the wizard. From form design view, choose View, Toolbox,
    then toggle on the button with the wand and stars. Then place a command
    button, and the wizard will guide you through. Select the form, choose "Open
    With Selected Data", and identify the controls on each form that have the
    matching data. The wizard will generate code similar to this:

    Dim stDocName As String
    Dim stLinkCriteria As String

    stDocName = "YourSecondForm"

    stLinkCriteria = "[FieldOn2ndForm]=" & Me![ControlOn1stForm]
    DoCmd.OpenForm stDocName, , , stLinkCriteria

    Hope that helps.
    Sprinks

    "Angus Comber" wrote:

    > Hello
    >
    > I want to display just one row from a table.
    >
    > Eg: SELECT * FROM Table1 WHERE xyzID = SomeValue
    >
    > I can do it all in code but am hoping because it is Access I can maybe do it
    > with limited code?
    >
    > Eg on one form I have the SomeValue - want to then in OnClick Event pass
    > SomeValue to say a query to get data for form?
    >
    > Hope I am explaining myself ok.
    >
    > How do I do that?
    >
    > Form will be standard fields - eg text fields displaying row data.
    >
    > Angus
    >
    >
    >
     
  4. Rick Brandt

    Rick Brandt
    Expand Collapse
    Guest

    Angus Comber wrote:
    > Hello
    >
    > I want to display just one row from a table.
    >
    > Eg: SELECT * FROM Table1 WHERE xyzID = SomeValue
    >
    > I can do it all in code but am hoping because it is Access I can
    > maybe do it with limited code?
    >
    > Eg on one form I have the SomeValue - want to then in OnClick Event
    > pass SomeValue to say a query to get data for form?
    >
    > Hope I am explaining myself ok.
    >
    > How do I do that?
    >
    > Form will be standard fields - eg text fields displaying row data.
    >
    > Angus


    Drop a new button onto your form in design view making sure that the toolbox
    wizard is enabled. One of the wizard options for opening a form with a
    button will do exactly what you want.

    --
    Rick Brandt, Microsoft Access MVP
    Email (as appropriate) to...
    RBrandt at Hunter dot com
     
  5. Angus Comber

    Angus Comber
    Expand Collapse
    Guest

    Re: Really basic question - easiest way to just display ONE record fro

    definitely. that was what I need. I come from a coding background so
    trying to adjust to use code as little as possible for productivity with
    Access now.


    "Sprinks" <Sprinks@discussions.microsoft.com> wrote in message
    news:8E26303F-C87A-4AC1-AC35-9792D9D14D54@microsoft.com...
    > Angus,
    >
    > To use the current record as a filter for opening a second form, pass the
    > value to the Where parameter of the Openform method. This is most easily
    > done by enabling the wizard. From form design view, choose View, Toolbox,
    > then toggle on the button with the wand and stars. Then place a command
    > button, and the wizard will guide you through. Select the form, choose

    "Open
    > With Selected Data", and identify the controls on each form that have the
    > matching data. The wizard will generate code similar to this:
    >
    > Dim stDocName As String
    > Dim stLinkCriteria As String
    >
    > stDocName = "YourSecondForm"
    >
    > stLinkCriteria = "[FieldOn2ndForm]=" & Me![ControlOn1stForm]
    > DoCmd.OpenForm stDocName, , , stLinkCriteria
    >
    > Hope that helps.
    > Sprinks
    >
    > "Angus Comber" wrote:
    >
    > > Hello
    > >
    > > I want to display just one row from a table.
    > >
    > > Eg: SELECT * FROM Table1 WHERE xyzID = SomeValue
    > >
    > > I can do it all in code but am hoping because it is Access I can maybe

    do it
    > > with limited code?
    > >
    > > Eg on one form I have the SomeValue - want to then in OnClick Event pass
    > > SomeValue to say a query to get data for form?
    > >
    > > Hope I am explaining myself ok.
    > >
    > > How do I do that?
    > >
    > > Form will be standard fields - eg text fields displaying row data.
    > >
    > > Angus
    > >
    > >
    > >
     

Share This Page