Results 1 to 3 of 3

Thread: Sql Search

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2001
    Location
    London
    Posts
    101

    Sql Search

    Hi,
    I have a program which stores pension contributions in a two table access database. Each Pension can be calculated any amount of times. I am having a problem searching as I must presume that I do not know the calculation run number. I therefore need to enter the Pension number which will return the list of runs performed on it. Then select which run I wish to view.
    Is this possible or would it be too complicated.

    SchemeDetails Table ContributionDetails Table

    SchemeRunID (PK) Month
    PensionID MonthlyCharge
    DateCalculated Value of Contrib
    SchemeRunID (FK)


    The PK and FK are joined in Access Relationships
    I have sent the info into the access db using ado and I display the contents of the ContributionDetails table in a flexgrid

  2. #2
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    The Dark Side of the Moon
    Posts
    448
    Create an SQL statement using a string in VBA if you're using access. Concatenate the variables in the parts where you need to specify criteria. Once the whole SQL statement is properly concatenated in a string apply it to the recordsource of the form.

    MyForm.RecordSource = strMySQLStatement

    Then show the appropriate fields of information on the form and navigate through the searched results. (NOTE: Concatenating a SQL statement together can be kinda of tricky due to SYNTAX error)

  3. #3
    Lively Member sjwesley's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    73
    You could use a query like this,


    select * from ContributionDetails where SchemeRunID in (select SchemeRunID from SchemeDetails where PensionID = your_actual_pension_IDyour_actual_pension_ID
    A time to love, and a time to hate; a time of war, and a time of peace - Ec:3:8

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width