Results 1 to 4 of 4

Thread: Access 2000; Selecting records

  1. #1
    Join Date
    Jul 2003
    Posts
    1

    Question Access 2000; Selecting records

    form in datasheet view, detailing a some of the fields from each record. How can I click on the one record in the datasheet and open a form with complete details of this record?

  2. #2
    Join Date
    Jan 2003
    Location
    UK
    Posts
    277
    Have a look at the Where part of the DoCmd.OpenForm method in the help file. It allows you to pass values into an opening form in order to filter to a specific record.

  3. #3
    Join Date
    Aug 2003
    Location
    In a galaxy far, far away...
    Posts
    28
    If you have a table with 10 columns and a continuous form with only 2 or three of it (let's call them C1, C2, C3, and a form frm_mainform) and let say C1 is the key column, simply edit C1's ON CLICK property and create even a macro or a VBA code like docmd.openform "MyDetailedForm".

    Then create a single form called MyDetailedForm put as many text fields as many you want on it (call then e.g. Cnt1,Cnt2...)and edit the form's ON LOAD property like this:

    DIM ds as datasource, rs as DAO.recordset, sql as string

    set db = currentdb

    sql = "select c1,c2,c3,...cn from table where c1 = " & frm_mainform!c1

    set rs = ds.openrecordset(sql,dbopensnapshot,dbseechanges)

    then if your controls are text fields

    cnt1.value = rs.fields(0)
    cnt2.value = rs.fields(1)

    and so on

    or if you put labels instead

    cnt1.caption = rs.fields(0)
    cnt2.caption = rs.fields(1)

    and so on.


    This is my way. Maybe not the best, but it works in any case.

  4. #4
    Join Date
    Aug 2003
    Location
    In a galaxy far, far away...
    Posts
    28
    Ooooops.

    I made a mistake.

    DIM ds as datasource, rs as DAO.recordset, sql as string

    incorrect!!!

    DIM ds as database, rs as DAO.recordset, sql as string

    correct.

Posting Permissions

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