Results 1 to 5 of 5
  1. #1
    Join Date
    Feb 2006
    Posts
    60

    Unanswered: How To 'Extract' Some Value From Tables

    I have documents in my database. Each document has an ID to seperate them. They have all the usual other document fields, but also a 'Report Name' field. In this field i have the name of the access report used to 'view' this document. I have this so when viewing old documents you can see it the way it was sent if the document template was updated (its to do with our Quality Assurance system).

    I am changing the way my Database works a little. I have document logs page which i had a standard 'details' form, but now i am changing it to a form with a list box. I can extract the document ID from this list box easy. But now that i have this i need to find out the report name, so that when the buttons for previewing and printing the document are pushed they work. So how do i extract that value from in my code? My current code is (for printing)

    Dim stLinkCriteria As String
    stLinkCriteria = "[Doc ID]=" & Me![Doc ID]
    DoCmd.OpenReport [Form_Number], acPreview, , stLinkCriteria

    RunCommand acCmdPrint

    DoCmd.Close acReport, [Form_Number]

    I need to use the Doc ID to find the Form_Number cause it isn't in the list box. They are both in the same table called T-Documents. This is for access 2000 and is a front and back end database btw.

  2. #2
    Join Date
    Feb 2004
    Location
    One Flump in One Place
    Posts
    14,912
    Gosh - this seems fairly trivial given the reasonably complex set up you already have

    Is there any reason you can't include the report name in the query that populates the list box and just set the coumn width to 0 (therefore hiding it)? The name would then be there already and you wouldn't need to do anything fancy to retrieve it. If this is a problem then there are other methods available anyway.
    Testimonial:
    pootle flump
    ur codings are working excelent.

  3. #3
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    I handle this function (preserving how the document looked when it was issued) by printing the document to snapshot and actually saving the snapshot file.

    In anycase, as suggested, include that field in your combo box query. Lookup the Column property (among others) of combo boxes for direction on getting the value sitting in positions other than the bound column in a combo box.

    tc

  4. #4
    Join Date
    Feb 2006
    Posts
    60
    yeah i know i can just hide the column but i am interested in learning other methods of doing so. if i can get this working i can use it in other areas of my database.

    for example i plan on integrating a user system into my database. i have found various ways of retrieving the username of windows (ie. what they are logged in as), but i want to use that username to then check in a table and then read different columns to see what permisions they have, which would be ticked yes or no. So if they could make reports, print them or not etc. , if they are an admin, manager, project manager or just a user etc. then each one would be able to get into different areas.

  5. #5
    Join Date
    Apr 2004
    Location
    outside the rim
    Posts
    1,011
    So you want to start using Recordsets.

    Recordsets allow you to move light years beyond the basic, bound objects that Access offers. There is a plethora info on Recordsets here, other Access forums, MSDN, even the help file.

    Have fun!

Posting Permissions

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